Skip to content

Commit 6cdcec7

Browse files
authored
Initial commit
0 parents  commit 6cdcec7

File tree

13 files changed

+188
-0
lines changed

13 files changed

+188
-0
lines changed

.github/workflows/gh-pages.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: github pages
2+
3+
on: ["push", "workflow_dispatch"]
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-18.04
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
submodules: true # Fetch Hugo themes (true OR recursive)
12+
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
13+
14+
- name: Setup Hugo
15+
uses: peaceiris/actions-hugo@v2
16+
with:
17+
hugo-version: '0.86.1'
18+
extended: true
19+
20+
- name: Build
21+
run: hugo --minify -F
22+
23+
- name: Deploy
24+
uses: peaceiris/actions-gh-pages@v3
25+
with:
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
27+
publish_dir: ./public
28+
user_name: 'github-actions[bot]'
29+
user_email: 'github-actions[bot]@users.noreply.github.com'
30+
commit_message: ${{ github.event.head_commit.message }}

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "themes/mainroad"]
2+
path = themes/mainroad
3+
url = https://github.com/Vimux/Mainroad

README.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
![top](./readme_resource/top.png)
2+
HUGOを使ったブログを簡単に作成するためのテンプレートです
3+
4+
[MORE INFO (Zenn)](https://zenn.dev/kato_k/articles/66531db0c4024d)
5+
6+
7+
## forkするだけでできること
8+
- GitHub Actionsによる自動デプロイ
9+
- GitHub Pagesに公開
10+
11+
## セットアップ
12+
13+
### HUGOの設定
14+
`config.toml`を編集してhugoの設定をします
15+
`$ hugo serve`を実行してページのプレビューを確認できます
16+
17+
#### Baseurl
18+
```
19+
baseURL = "https://{Github ユーザー名}.github.io/{forkしたリポジトリ名}"
20+
```
21+
#### ブログのタイトル
22+
```
23+
title = "hugo-blog-template"
24+
```
25+
26+
#### 自己紹介
27+
```
28+
[Author]
29+
name = "Author"
30+
bio = "ここに自己紹介を入れることができます"
31+
avatar = "img/avatar.png"
32+
```
33+
アバターの画像は`static/img/avatar.png`に配置しています
34+
35+
#### ページのテーマカラー
36+
```
37+
[Params.style.vars]
38+
highlightColor = "#e22d30"
39+
```
40+
`#rrggbb`の形式で指定してください
41+
42+
#### SNS等のユーザー名
43+
```
44+
[Params.widgets.social]
45+
twitter = "uvrub"
46+
github = "kato-k"
47+
```
48+
アカウントIDを指定するとサイドバーに表示されます
49+
50+
### GitHub Pagesの設定
51+
`config.toml`の変更をリモートリポジトリに反映すると、GitHub Actionsによってページのビルドが走ります。
52+
ビルド結果は`github-actions[bot]`によって`gh-pages`ブランチにコミットされます。
53+
54+
#### ページの公開
55+
リポジトリの`Settings`タブ→`Pages`を開いてください。
56+
![publish](./readme_resource/gh-pages.png)
57+
画像の四角で囲った部分を`gh-pages`に変更し、`save`をクリックすると公開が始まります。
58+
アクセスできるようになるまで10分程度間があります。

archetypes/default.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "{{ replace .Name "-" " " | title }}"
3+
date: {{ .Date }}
4+
categories: [""]
5+
tags: [""]
6+
---
7+

config.toml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# 公開するページのURL
2+
baseURL = "https://kat0h.github.io/hugo-blog-template"
3+
4+
languageCode = "ja"
5+
DefaultContentLanguage = "ja"
6+
HasCJKLanguage = true
7+
enableRobotsTXT = true
8+
9+
# ブログのタイトル
10+
title = "hugo-blog-template"
11+
12+
theme = "mainroad"
13+
paginate = 20
14+
15+
# 自己紹介
16+
[Author]
17+
name = "Author"
18+
bio = "ここに自己紹介を入れることができます"
19+
avatar = "img/avatar.png"
20+
21+
[Params]
22+
customCSS = ["css/custom.css"]
23+
copyright = "Author"
24+
readmore = true
25+
authorbox = true
26+
post_meta = ["date", "categories"]
27+
twitter_cards = true
28+
29+
# ページのテーマカラー
30+
[Params.style.vars]
31+
highlightColor = "#e22d30"
32+
33+
# SNS等のユーザー名
34+
[Params.widgets.social]
35+
twitter = "uvrub"
36+
github = "kato-k"
37+
38+
[Params.sidebar]
39+
home = "right"
40+
list = "right"
41+
single = "right"
42+
widgets = ["search", "recent", "categories", "taglist", "social"]
43+

content/posts/sample/image.jpeg

191 KB
Loading

content/posts/sample/index.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "Sample Page"
3+
date: 2021-01-01
4+
categories: ["hugo"]
5+
tags: ["go", "markdown"]
6+
menu: main
7+
---
8+
9+
# HUGOのサンプル
10+
11+
# h1
12+
## h2
13+
### h3
14+
#### h4
15+
##### h5
16+
###### h6
17+
<!-- menu: mainを使うとトップバーに固定される -->
18+
19+
- a
20+
- b
21+
- c
22+
- d
23+
- e
24+
- f
25+
26+
- `$ bash`
27+
- **BOLD**
28+
- *italic*
29+
- ~~44GG44KT44GT~~
30+
31+
```c
32+
#include <stdio.h>
33+
34+
int main() {
35+
printf("Hello, World!\n");
36+
return 0;
37+
}
38+
```
39+
40+
{{<figure src="./image.jpeg" alt="モード" width="75%">}}

layouts/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Sitemap: {{ .Site.BaseURL }}sitemap.xml

readme_resource/gh-pages.png

38 KB
Loading

readme_resource/top.png

48.9 KB
Loading

static/css/custom.css

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;300&display=swap');
2+
body {
3+
font-family: 'Noto Sans JP', sans-serif;
4+
}

static/img/avatar.png

85.8 KB
Loading

themes/mainroad

Submodule mainroad added at 043befb

0 commit comments

Comments
 (0)