In this article, the words parameter and variable are synonyms.
A variable name that a Hugo user creates is called a custom variable or a user-defined variable.
The names of Hugo variables (including those specified in config files and front matter)…
can contain
underscores (_
) and alphanumeric characters,
must start with
an
underscore (_
) or alpha character,
and
must not
contain a dash
character
(-
).[2]
User-defined
variables in a layout file must
start with a dollar sign ($
).
In
a Hugo config file,
built-in
variables — such as
baseURL
,
enableEmoji
,
enableInlineShortcodes
,
languageCode
,
Permalinks
,
themes
, themesDir
,
and
title
— are sometimes case sensitive
so I recommend that you specify them using the upper- and
lower-case letters that are specified
in
gohugo.io/getting-started/configuration/.
ℹ | The
casing used in
the variable names
enableEmoji ,
enableInlineShortcodes ,
languageCode ,
and
themesDir
is called
camelCase🐫.[3] |
Because of the above and other case-sensitivity issues,
bep, Hugo’s lead developer, recommends
all lower case
snake_case🐍 — for example $this_year
and $that_year
— for custom variable names. For more about this recommendation, see
discourse.gohugo.io’s
Best practices for naming variables
etc [2020-May].
For more about Hugo, see Infinite Ink’s…
Hugo’s Markup Languages: AsciiDoc, HTML, Markdown,
Hugo Shortcodes: Including Go Templates in Hugo Content Files
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)📊
TGIH: Themeless & Gitless Introduction to the Hugo SSG (a tutorial)
🔗 Linkified Section Headings in Hugo-Generated Web Pages (featuring Markdown and AsciiDoc examples)
Hugo’s .RenderString
Method (featuring AsciiDoc admonitions in Markdown and Go HTML)
-
) is “hyphen-minus,” but its proper name is rarely used. Instead, it is usually called “dash,” “hyphen,” or “minus.” Details are at wikipedia.org’s Hyphen-minus.@nm@mathstodon.xyz
or
#InfiniteInk
in it.