Hyphenated .Page.Param

Hi there,

Fairly new user of Hugo, run into a problem.

I wish to use a hyphenated custom parameter - in this case mf-syndication and/or mf-photo

I can see the parameter and the string of the parameter reported correctly in a {{ printf "#%v" .Params }}

` map[string]interface {}{“mf-syndication”:“@_dgoldsmith on Instagram”}

However, any attempt to access the string by calling {{ .Params.mf-syndication }}

results in

ERROR: 2017/01/28 19:54:48 template.go:529: template: theme/partials/micrometadata.html:11: bad character U+002D '-'

and failure of the template.

Any ideas?

I think you need to use underscores instead.

Okay, but that’s not actually an option (due to reliance on 3rd party libraries and services).

There’s nothing (that I can find) in the docs which tells me why this is or should be an error.

It is in the Go templates docd. Use the index func as a worksround.

1 Like