基础配置
Hugo 配置文件格式支持:hugo.toml、hugo.yaml、hugo.json,并按照上述顺序索引,支持根据环境、根配置键、语言拆分单个配置文件。
Note
访问 Hugo 文档 查看详细内容。
Hugo Narrow 使用拆分的配置结构,格式采用 YAML。
- hugo.yaml
- languages.yaml
- menus.yaml
- params.yaml
站点配置和一般 Hugo 站点差别不大,较为特殊的是:
permalinks.projects为项目永久链接设置outputFormats.WebAppManifest为主题自动生成WebAppManifest配置highlight.lineNumbersInTable需要设置为falsehighlight.style设置不生效,Hugo Narrow 代码块主题更改需更改样式文件。- Hugo 最低版本为 0.146
baseURL: https://hugo-narrow.vercel.app/
languageCode: en-US
defaultContentLanguage: en
defaultContentLanguageInSubdir: false
title: Hugo Narrow
theme: "hugo-narrow"
hasCJKLanguage: true
enableEmoji: true
permalinks:
posts: /posts/:slug/
projects: /projects/:slug/
pages: /:slug/
pagination:
pagerSize: 6
path: "page"
taxonomies:
category: categories
tag: tags
markup:
tableOfContents:
startLevel: 2
endLevel: 4
ordered: false
goldmark:
renderer:
unsafe: true
extensions:
extras:
delete:
enable: true
insert:
enable: true
mark:
enable: true
subscript:
enable: false
superscript:
enable: false
strikethrough: false
highlight:
codeFences: true
guessSyntax: false
lineNos: false
lineNumbersInTable: false # 设置为 false
noClasses: false
style: github # 不需要更改
tabWidth: 2
outputs:
home: ["HTML", "RSS", "JSON", "WebAppManifest"]
# 自定义输出格式
outputFormats:
WebAppManifest:
mediaType: "application/manifest+json"
baseName: "site"
isPlainText: true
module:
hugoVersion:
extended: true
min: 0.146.0