Hugo supports hugo.tomlhugo.yamlhugo.json format and follow the order, supporting split configuration file by envirament, root configuration key, and language.

Hugo Narrow uses split configuration with YAML.

BASH
1exampleSite/
2├── config/
3│   └── _default/
4│       ├── hugo.yaml
5│       ├── languages.yaml
6│       ├── menus.yaml
7│       └── params.yaml
8└── content/
Click to expand and view more

The site configuration is not much different from that of a regular Hugo site; the special part is:

  1. permalinks.projects sets the permalinks for projects.
  2. outputFormats.WebAppManifest automatically generates the WebAppManifest configuration for the theme.
  3. highlight.lineNumbersInTable needs to be set to false.
  4. highlight.style setting does not take effect. To change the Hugo Narrow codeblock style, you need to modify the CSS files.
  5. The minimum required version of Hugo is 0.146.
YAML
 1baseURL: https://hugo-narrow.vercel.app/
 2languageCode: en-US
 3defaultContentLanguage: en
 4defaultContentLanguageInSubdir: false
 5title: Hugo Narrow
 6theme: "hugo-narrow"
 7
 8hasCJKLanguage: true
 9enableEmoji: true
10
11permalinks:
12  posts: /posts/:slug/
13  projects: /projects/:slug/
14  pages: /:slug/
15
16pagination:
17  pagerSize: 6
18  path: "page"
19
20taxonomies:
21  category: categories
22  tag: tags
23  series: series
24
25markup:
26  tableOfContents:
27    startLevel: 2
28    endLevel: 4
29    ordered: false
30  goldmark:
31    renderer:
32      unsafe: true
33    extensions:
34      extras:
35        delete:
36          enable: true
37        insert:
38          enable: true
39        mark:
40          enable: true
41        subscript:
42          enable: false
43        superscript:
44          enable: false
45      strikethrough: false
46  highlight:
47    codeFences: true
48    guessSyntax: false
49    lineNos: false
50    lineNumbersInTable: false # Set to false
51    noClasses: false
52    style: github # No need to change
53    tabWidth: 2
54
55outputs:
56  home: ["HTML", "RSS", "JSON", "WebAppManifest"]
57
58# Custom output
59outputFormats:
60  WebAppManifest:
61    mediaType: "application/manifest+json"
62    baseName: "site"
63    isPlainText: true
64
65module:
66  hugoVersion:
67    extended: true
68    min: 0.146.0
Click to expand and view more

主要 Sections

Hugo Narrow could configure the main sections, which are used for global search.

config/_default/hugo.yaml
1mainSections: ["posts", "projects", "pages"]
Click to expand and view more

The recent posts of home page will use the first section.

Copyright Notice

Author: Hugo Narrow

Link: https://hugo-narrow-docs.vercel.app/docs/basic-config/

License: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut