Hugo templates are not rendered as expected

Hello! I don’t understand why when I write smth like this: {{ .Site.Data.test.name }} to obtain name key in data/test.yml template is not rendered to Emily string (it’s a value of this key). I just get:

It confuses me after Jekyll where there was no such problem. May be I am missing smth but I don’t realize what exactly.

Hugo version: hugo v0.98.0-165d299cde259c8b801abadc6d3405a229e449f6 linux/amd64 BuildDate=2022-04-28T10:23:30Z VendorInfo=gohugoio (I’ve updated it just now and tested everything again… Templates don’t work as expected :thinking: …)

A link to your repo would make it easier to investigate.

Are you perhaps adding the {{ .Site.Data.test.name }} to a content (i.e. markdown) file?

It only works in templates (including partials and shortcodes).

1 Like

Yes, I’ve placed it in .md file. Thanks! :relaxed:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.