Newbie question: can't access Page Params from homepage

Hello forum,

coming from systems like Processwire and Typo 3 I’m new to static site generators and Hugo. Currently I’m developing a basic theme and everything works fine apart from not being able to access some params defined in the front matter of index.md from index.html template.

I’m in my themes subdirectory and my tree looks like this:

layouts ├── 404.html ├── _default │ ├── list.html │ └── single.html ├── index.html └── partials ├── footer.html └── header.html

And in the root directory I have:

content ├── fragen │ └── index.md ├── impressum.md ├── index.md ├── kontakt.md ├── leistungen │ └── index.md ├── praxis │ └── index.md └── schwangerschaft └── index.md

Within the front matter of content/index.md I’ve defined a param for testing purposes:

testing = "Hallo Welt!"

However, I can’t access this param within themes/mytheme/layouts/index.html (which apart from that renders the content of index.md fine). Both of the following attempts render nothing:

{{ $.Param "testing" }}
{{ .Params.testing }}

Debugging confirms the params are not present:

{{ printf "%#v" $.Site }}

echoes empty.

However, params I’ve defined in config.toml are present and can be echoed.

I’m sure I’m missing the point here somehow. Any help for a newbie is greatly appreciated. Thanks in advance.

Site params go into config.toml (or whatever format your site config is in). Putting params into the frontmatter of a content file creates page params, which are separate from site params.