I currently have a basic post with the following expected behavior : use a parameter called reference to make the shortcode load dynamically the information from a yaml file in the data/post folder
{{ $data := index .Site.Data.post (.Page.Params.Get "reference") }}
{{ with $data.conclusion }}
<div style="">
<p>{{ .text }}</p>
</div>
{{ end }}
And a “data” file called *002.yml’ in the data/post folder :
conclusion:
- text: "bla bla"
- rate: 18
Unfortunatly i can’t access the text part of the conclusion and can’t figure out why :
execute of template failed: template: shortcodes/conclusion.html:4:8: executing "shortcodes/conclusion.html" at <.text>: can't evaluate field text in type []interface {}