.
└── TGIH/ ⟵project root
├── archetypes/
├── assets/
├── content/
├── layouts/
├── static/
└── config.yamlOngoing
According to
Repology,
the latest
packaged Hugo
is
.
2023-January-9
As of today, this evolving[1]
article
has been on
the web
for
config.yaml, config.toml, or config.json fileFor a simple Hugo project,
a single configuration file
in the
project root[2]
is fine.
For example,
here is the structure
of the TGIH project
used in
Infinite Ink’s
TGIH: Themeless & Gitless Introduction to the
.
└── TGIH/ ⟵project root
├── archetypes/
├── assets/
├── content/
├── layouts/
├── static/
└── config.yamlNote that a Hugo configuration file can be specified in JSON, TOML, or YAML format and any of the following can be used as the file name.
config.json
config.toml
config.yaml
Throughout this article, I use YAML format.[3]
config directoryStarting with
Hugo v0.53,
you
have the option of putting
your configuration file(s)
in a config directory. For example, the following
structure
is
equivalent to
the above
structure.
.
└── TGIH/
├── archetypes/
├── assets/
├── config/
│ └── _default/
│ └── config.yaml
├── content/
├── layouts/
└── static/
One of the advantages of using a config directory is that you
can
put a configuration
block
into its own file.
For example,
Infinite Ink’s
original
(uncompartmentalized)
config.yaml
looked like this:
## next discussed in www.ii.com/hugo-tutorial/#_enableemoji enableEmoji: true ## next discussed in www.ii.com/yaml-atoms-maps-lists/ cacheDir: 'C:\Hugo_cache_infiniteink' ## next block discussed in www.ii.com/hugo-sitemapdottxt/ sitemap: filename: sitemap.txt outputFormats: html: isPlainText: true ⋮ ## next discussed in www.ii.com/hugo-security-config/ security: enableInlineShortcodes: true exec: allow: - ^asciidoctor - ^pandoc osEnv: - .* funcs: getenv: - ^INFINITEINKROOT$ http: methods: - none urls: - none
After moving the above security block to its own file, the Infinite Ink directory structure looks like this:
.
└── INFINITEINK/
├── archetypes/
├── assets/
├── config/
│ └── _default/
│ ├── config.yaml
│ └── security.yaml ⟵👀
├── content/
├── layouts/
└── static/
And the config/_default/security.yaml file
looks like this:
enableInlineShortcodes: true exec: allow: - ^asciidoctor - ^pandoc osEnv: - .* funcs: getenv: - ^INFINITEINKROOT$ http: methods: - none urls: - none
‼ | When
the security block is moved from config.yaml to security.yaml,
the leading security: key must be removed. |
To learn about the above security settings, see Infinite Ink’s Configuring Security in Hugo.
For more about Hugo, see Infinite Ink’s…
Variable and Parameter Names in Hugo (featuring camelCase🐫 and snake_case🐍)
Configuring Security in Hugo (featuring settings needed to use Asciidoctor and Pandoc)🔒
Transforming Text with Hugo (featuring plainify, htmlUnescape, and more)
A Way to Compare Hugo’s Markup Languages (featuring inline footnotes)📊
Hugo’s Markup Languages: AsciiDoc, HTML, Markdown,
Hugo Shortcodes: Including Go Templates in Hugo Content Files
Hugo’s .RenderString Method (featuring AsciiDoc admonitions in Markdown and Go HTML)
🔗 Linkified Section Headings in Hugo-Generated Web Pages (featuring Markdown and AsciiDoc examples)
@nm@mathstodon.xyz
or
#InfiniteInk
in it.