Site configuration

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
languageCode = 'en-us'
MetaDataFormat = "yaml"
title = 'Hugo Cosmos'
enableGitInfo = true
enableRobotsTXT = true
theme = "hugo-theme-cosmos"
baseURL = "https://hugo-theme-cosmos.netlify.app/"
googleAnalytics = 'G-ST7MVBC6EK'

[menu]
  span>.    title = "documentation"
    name = "book"
    url = "/docs/"
    weight = -50
  span>.    title = "garden"
    name = "brain"
    url = "/garden/"
    weight = -40
  span>.    title = "github"
    name = "github"
    url = "https://github.com/librabyte/hugo-theme-cosmos"
    weight = -30
  span>.    title = "rss"
    name = "rss"
    url = "/index.xml"
    weight = -20


[markup]
  [markup.highlight]
    style = 'monokai'
    codeFences = true
    guessSyntax = false
    lineNoStart =1
    lineNos = true
    lineNumbersInTable = true

  [markup.tableOfContents]
    endLevel = 6
    ordered = false
    startLevel = 2

  [markup.goldmark.renderer]
    unsafe = true


[module]
  [module.mounts]
    source = 'assets'
    target = 'assets'


[params]
  since = "2019"
  dateFormat = "January 2, 2006"

  enableHomeProfile = false
  mainSections = ["posts"]
  bookSection = "docs"
  photoSwipe = false

  # (Optional, default false) Enables SEO with google analytics.
  googleAnalytics = true
  # (Optional, default false) Enables search function with fuse.js.
  search = true
  # (Optional, default true) Display a "Back to top" link in the site footer.
  back2top = true
  # (Optional, default true) Enable douban short code for douban music/book reference.
  douban = true
  # (Optional, default true) Enable Table of Contents in the right sidebar.
  toc = true
  # (Optional, default true) always collapse in the file tree mode.
  alwaysCollapse = true

  # (Optional, default false) enable wikilink feature.
  [params.wikilink]
    enableWikilink = true
    enableBacklinks = true
    enableLinkPreview = false

  # (Optional, default true) Enable giscus as comment plugin.
  [params.comments.giscuss]
    enable = true
    repo = "librabyte/hugo-theme-cosmos"
    repoId = "R_kgDOIEDNvg"
    category = "Announcements"
    categoryId = "DIC_kwDOIEDNvs4CTiKG"
    theme = "light"

  [params.reward]
    enable = true
    [params.reward.items]
      wechat = "https://cosmos-1251905798.cos.ap-beijing.myqcloud.com/theme/wechatpay.png"
      alipay = "https://cosmos-1251905798.cos.ap-beijing.myqcloud.com/theme/alipay.jpg"

  [params.copyright]
    # (Optional, default true) Enable copyright info display in the post footer.
    enable = true
    content = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>'
    [params.copyright.gitInfo]
      gitRepo = "https://github.com/librabyte/hugo-theme-cosmos"
      showCommitMessage = true

  [params.markmap]
    enable = true

  [params.mermaid]
    enable = true

  [params.echarts]
    # enable/disable ECharts support
    enable = true
    map = true

  [params.katex]
    # enable/disable KaTeX support
    enable = true

[outputs]
  home = ["HTML", "RSS", "JSON"]

[sitemap]
  changefreq = 'monthly'
  filename = 'sitemap.xml'
  priority = 0.5

Page configuration

Hugo allows you to add front matter in yaml, toml, or json to your content files. You can reference Front Matter1 for predefined variables that Hugo is aware of.

Hugo Cosmos also has its specific variables for better management of your content. Here is the variables that mostly used.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Title of the page
title: "Hugo Cosmos Configuration"

# Author of the page
author: "librabyte"

# The date associated with the page
date: "2023-01-26"
# Set page weight to re-arrange items in file-tree menu.
weight: 10

# Enable Table of Contents for page, this cooperates with `.Site.Params.toc`
toc: true

# Tags for the page, it is a list
tags: ["hugo", "math"]

# Categories for the page, it is a list
categories: ["Cosmos", "Hugo"]

# Set to true to enable meting music in the page, default false
meting: true

# Set to true to enable mermaid diagrams in the page, default false
mermaid: true

# Set to true to enable markmap mindmaps in the page, default false
markmap: true

# Set to true to enable ECharts diagrams in the page, default false
echarts: true

# Set to true to enable ECharts Maps in the page, default false
echartsMap: true

# Set to true to enable math formulae in the page, default false
math: true

# Set to false to open automatically, default true, always collapse in the file tree mode 
alwaysCollapse: true