Skip to content

Commit 74723ab

Browse files
committed
build: switch theme from Hugo Book to Hextra
- Replace themes/book submodule with themes/hextra - Rewrite hugo.toml for Hextra (menu, search, theme toggle, editURL) - Add cascade type=docs in _index.md so all pages use docs layout - Remove duplicate H1 from content since Hextra renders title as H1
1 parent eec60c4 commit 74723ab

8 files changed

Lines changed: 76 additions & 21 deletions

File tree

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "themes/book"]
2-
path = themes/book
3-
url = https://github.com/alex-shpak/hugo-book
1+
[submodule "themes/hextra"]
2+
path = themes/hextra
3+
url = https://github.com/imfing/hextra.git

content/_index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
+++
22
title = '總覽'
33
type = 'docs'
4-
bookToc = false
4+
weight = 0
5+
6+
[cascade]
7+
type = 'docs'
58
+++
69

710
<!--
@@ -10,8 +13,6 @@ bookToc = false
1013
本中文版本為翻譯之衍生著作,僅供學習與內部參考。
1114
-->
1215

13-
# Go 風格指南
14-
1516
<https://google.github.io/styleguide/go>
1617

1718
[總覽](/) | [指南](/guide/) | [決策](/decisions/) |

content/best-practices.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ weight = 3
1010
本中文版本為翻譯之衍生著作,僅供學習與內部參考。
1111
-->
1212

13-
# Go 風格最佳實踐
14-
1513
<https://google.github.io/styleguide/go/best-practices>
1614

1715
[總覽](/) | [指南](/guide/) | [決策](/decisions/) |

content/decisions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ weight = 2
1010
本中文版本為翻譯之衍生著作,僅供學習與內部參考。
1111
-->
1212

13-
# Go 風格決策
14-
1513
<https://google.github.io/styleguide/go/decisions>
1614

1715
[總覽](/) | [指南](/guide/) | [決策](/decisions/) |

content/guide.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ weight = 1
1010
本中文版本為翻譯之衍生著作,僅供學習與內部參考。
1111
-->
1212

13-
# Go 風格指南
14-
1513
<https://google.github.io/styleguide/go/guide>
1614

1715
[總覽](/) | [指南](/guide/) | [決策](/decisions/) |

hugo.toml

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,84 @@
11
baseURL = 'https://appleboy.github.io/go-tutorial/'
22
languageCode = 'zh-tw'
33
title = 'Go 風格指南(繁體中文)'
4-
theme = 'book'
4+
theme = 'hextra'
55

6+
enableRobotsTXT = true
67
enableGitInfo = true
8+
enableEmoji = true
9+
710
canonifyURLs = true
811

9-
[params]
10-
BookTheme = 'auto'
11-
BookToC = true
12-
BookRepo = 'https://github.com/appleboy/go-tutorial'
13-
BookEditPath = 'edit/main/content'
14-
BookSearch = true
15-
BookSection = '*'
12+
[outputs]
13+
home = ['HTML', 'RSS']
14+
page = ['HTML']
15+
section = ['HTML', 'RSS']
1616

1717
[markup]
1818
[markup.goldmark.renderer]
1919
unsafe = true
20+
[markup.highlight]
21+
noClasses = false
2022
[markup.tableOfContents]
2123
startLevel = 2
2224
endLevel = 4
2325
ordered = false
2426

27+
[menu]
28+
[[menu.main]]
29+
name = '指南'
30+
pageRef = '/guide'
31+
weight = 1
32+
[[menu.main]]
33+
name = '決策'
34+
pageRef = '/decisions'
35+
weight = 2
36+
[[menu.main]]
37+
name = '最佳實踐'
38+
pageRef = '/best-practices'
39+
weight = 3
40+
[[menu.main]]
41+
name = 'Search'
42+
weight = 4
43+
[menu.main.params]
44+
type = 'search'
45+
[[menu.main]]
46+
name = 'GitHub'
47+
weight = 5
48+
url = 'https://github.com/appleboy/go-tutorial'
49+
[menu.main.params]
50+
icon = 'github'
51+
52+
[params]
53+
description = 'Google Go Style Guide 繁體中文翻譯'
54+
55+
[params.navbar]
56+
displayTitle = true
57+
displayLogo = false
58+
59+
[params.theme]
60+
default = 'system'
61+
displayToggle = true
62+
63+
[params.page]
64+
width = 'normal'
65+
66+
[params.footer]
67+
enable = true
68+
displayCopyright = true
69+
displayPoweredBy = true
70+
71+
[params.search]
72+
enable = true
73+
type = 'flexsearch'
74+
[params.search.flexsearch]
75+
index = 'content'
76+
tokenize = 'forward'
77+
78+
[params.editURL]
79+
enable = true
80+
base = 'https://github.com/appleboy/go-tutorial/edit/main/content'
81+
82+
[params.toc]
83+
displayTags = false
84+
displayTimeToRead = false

themes/book

Lines changed: 0 additions & 1 deletion
This file was deleted.

themes/hextra

Submodule hextra added at aed8ffd

0 commit comments

Comments
 (0)