Variables not working in content files

Hi there,
I’m trying to get shortcodes to work in my content files, but for some reason they keep render as-is (i.e. showing {{ $.Site.Data.params }} instead of its value).

My layout file (layouts/_default/single.html):

    <div id="page-wrapper">

My content file (at this point just trying out variables):

    title: "Market Place"
    {{ .Title }}
    {{ $.Site.Data.params }}
    {{ range 1 }}
    {{ end }}

Hello and welcome to the forum.

In Hugo variables and functions (i.e. range) are meant for use in templates, shortcodes, partials etc but not directly in content files. You can call variables and functions through shortcodes in content files.

Please have a look at:

1 Like