I'm creating a page. I have a site-wide parameter defined in my default config.toml file like this.
[Params]
tdName= "Mr. Tournament Director"
In my page I'm writing:
{{ .Site.Params.tdName }}
Rather than the string in quotes, the code below that is litterally showing up when I run the "hugo server" command. What am I doing wrong?
Thanks.
To specify Go template code in a file in the
contentdirectory, you need to use a Hugo shortcode. For example, you could use this inline shortcode:To use inline shortcodes, as I do above, you need to set
enableInlineShortcodesto true in your config file.Note that:
site.Params.tdNameis usually equivalent to.Site.Params.tdNamebut is better because it is context free (no leading dot (.))tdNametotd_nameortdnameor something without upper case characters.