docs/content/en/configuration/params.md
Use the params key for custom parameters:
{{< code-toggle file=hugo >}} baseURL = 'https://example.org/' locale = 'en-US' title = 'Project Documentation' [params] subtitle = 'Reference, Tutorials, and Explanations' [params.contact] email = '[email protected]' phone = '+1 206-555-1212' {{< /code-toggle >}}
Access the custom parameters from your templates using the Params method on a Site object:
{{ .Site.Params.subtitle }} → Reference, Tutorials, and Explanations
{{ .Site.Params.contact.email }} → [email protected]
Key names should use camelCase or snake_case. While TOML, YAML, and JSON allow kebab-case keys, they are not valid identifiers and cannot be used when chaining identifiers.
For example, you can do either of these:
{{ .Site.params.camelCase.foo }}
{{ .Site.params.snake_case.foo }}
But you cannot do this:
{{ .Site.params.kebab-case.foo }}
For multilingual projects, create a params key under each language:
{{< code-toggle file=hugo >}} baseURL = 'https://example.org/' defaultContentLanguage = 'en'
[languages.de] direction = 'ltr' label = 'Deutsch' locale = 'de-DE' title = 'Projekt Dokumentation' weight = 1
[languages.de.params] subtitle = 'Referenz, Tutorials und Erklärungen'
[languages.de.params.contact] email = '[email protected]' phone = '+49 30 1234567'
[languages.en] direction = 'ltr' label = 'English' locale = 'en-US' title = 'Project Documentation' weight = 2
[languages.en.params] subtitle = 'Reference, Tutorials, and Explanations'
[languages.en.params.contact] email = '[email protected]' phone = '+1 206-555-1212' {{< /code-toggle >}}
To prevent naming conflicts, module and theme developers should namespace any custom parameters specific to their module or theme.
{{< code-toggle file=hugo >}} [params.modules.myModule.colors] background = '#efefef' font = '#222222' {{< /code-toggle >}}
To access the module/theme settings:
{{ $cfg := .Site.Params.module.mymodule }}
{{ $cfg.colors.background }} → #efefef
{{ $cfg.colors.font }} → #222222