Variable and Parameter Names in Hugo
Updated 2021-September-13

Page contents


2021-August-25  Published this evolving⁠[1] article.


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.


Allowed characters in Hugo variable names

The names of Hugo variables (including those that are specified in config files and front matter)…

  • cannot contain a dash character (-)[2]

  • and can contain underscores (_) and alphanumeric characters.

Custom variables in a layout file must start with a dollar sign ($).


Case sensitivity of Hugo variable names


Built-in variables

In a Hugo config file, built-in variables — such as baseURL, 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


Page-level variables

“Page-level .Params⁠[3] are only accessible in lowercase.”


Custom variables

Because of the above (and other) case-sensitivity issues, Bep, Hugo’s lead developer, recommends all lower case snake_case for custom variable names. For more about this, see’s Best practices for naming variables etc.


Hugo variable references

See also


1. Many Infinite Ink articles, including this one, are evergreen and regularly updated.
2. The Unicode name for the “dash” character (-) is “hyphen-minus,” but its proper name is rarely used. Instead it is usually called “dash,” “hyphen,” or “minus.” Details are at’s Hyphen-minus.
3. Page-level .Params are usually specified in front matter.

Comments 👍 👎 📝

Please comment so I know I'm not speaking into the void. Also, your public comment might improve this page or help me to improve this page.