Can anybody please explain the difference between .Params and .Param? I don’t understand the docs in this case. Tnx.
So, in a template:
-
.Paramswill give you the Page params map (defined in the current Page’s front matter) -
.Site.Paramswill give you the Site params map (defined in site config) -
.Paramis a method that takes a key as an argument; it will first look in the page’s params, and if not found, it defaults to the site param’s value.
.Param is a method to call a page or site variables into your template e.g. $.Param “image” will look for a parameter called image in a your frontmatter or in your config
See here: https://gohugo.io/functions/param/#readout
.Params is used either in the context of .Site.Params and it is a container with the values from the params section of your config https://gohugo.io/variables/site/#the-site-params-variable
Or as way to call frontmatter parameters in your template
e.g. {{ with .Params.venue }}{{ . }}{{ end }}
Super explanations - thank you all. That was one of my last questions. Hugo is getting better and better for me.
Gonna close this, but wanted to say…
One of them ends with “s”. ![]()