Last resort (community): No template rendering

I am totally lost. None of the templates are being evaluated.

For example, none of these work:

{{ .Params.description }}
Sum: {{ add 1 2 }}
{{ $address := “123 Main St.” }}
{{ $address }}
{{ range $index, $element := $.Site.Params }}
<p>{{ $index }} --- {{ $element }}</p>
{{ end }}

Those are some examples. Say they are in a None are evaluated but just displayed as-is. I have tried everything I can. What am I doing wrong? :man_facepalming:

Hugo Version

hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended darwin/arm64 BuildDate=2023-08-31T11:23:51Z VendorInfo=brew

Template code is only evaluated in template files (usually HTML). They reside in the layouts folder.

Markdown files in the content folder need to contain Markdown (optionally with shortcodes) with frontmatter.

You render their content in your templates. You mixed up these two parts.

I can have this {{ .Params.description }} in my markdown file and it should render the description, right?

No. You can use template code only in a template file like _default/single.html for example.

1 Like

No. If you had a shortcode you could use the shortcode using the syntax {{< insert-shortcode-output >}}, but you cannot use template code in Markdown.

1 Like

There is a concept of ‘inline shortcodes’ that might get you close:

1 Like

Yes, that looks like something I am looking for although not sure if it is a best practice. Anyways, it looks like I need something similar to <time.inline> into which I can shove stuff like {{ .Params.descriptiopn }}. Is there something built-in? Or do I have to write it myself? You see the entire section _ Inline shortcodes_ is just a few words :frowning_face:

While your experimenting, please notice: An arbitrary frontmatter parameter is accessible under .Params.arbitrary.

But the description parameter you chose in your example belongs to Hugo’s built-in set. It’s stored in .Description (as usual with an uppercase initial for built-in parameters).

I just took .Params.description as an example but I hear you.