Unable to use curly braces {{ }} for Data folder templates

Hello,

I have this problem when I am trying to reference the Data folder. I read the HUGO documentation.
I followed the instructions in the docs, but still not working. Let me explain what I did.

Step 1: Created data\jac.toml

image

Step 2: Referenced it in markdown file

{{ range $.Site.Data.jac }}
   {{ .discography }}
{{ end }}

{{ range .Site.Data.jac }}
  {{ .discography }}
{{ end }}

Step 3: Opened the browser


I don’t seem to understand why this is happening. I did exactly as was mentioned in the Hugo documentation (video as well as example) and it still doesn’t work.
Please help. I am new to Hugo.

Thanks,
Ayan

You can’t use {{ }} which is the hugo (go) template format. Markdown doesn’t know to parse hugo code.

You can put the code in a shortcode, and reference the shortcode in your markdown file

{{< jac >}} will work in markdown.

Shortcode would be /layouts/shortcodes/jac.html where you can put this code.


In the doc it says:

You can now render the list of recordings for all the bass players in a template

Start at Templating | Hugo.

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