Hello,
Following my github ticket, I open this discussion around Hugo shortcode feature.
I use a shortcode to render other pages content in a given page, and this can get generated recursively :
{{ $found := where .Site.Pages ".Params.code" "=" .Params.src }}
{{ if len $found | ge 1 }}
{{ range $found }}
<div style="border: thin solid black">
<h4><b>{{ .Title }}</b></h4>
<p>{{ .Content }}</p>
</div>
{{ end }}
{{ end }}
{{end}}
I use the followign code to use this procedure :
---
code: 'CODE01'
title: 'Some page'
---
{{% rendering src="CODE02" %}}
But Hugo, if run in one pass, is sometimes missing the .Content of the other pages rendered in the current page. I have to force multiple pass to ensure that everything gets generated correctly :
./hugo.exe server -s src/ -d public/ &
hugo_pid=$!
sleep 4
touch $1/layouts/shortcodes/rendering.html
sleep 2
touch $1/layouts/shortcodes/rendering.html
sleep 2
touch $1/layouts/shortcodes/rendering.html
sleep 2
touch $1/layouts/shortcodes/rendering.html
kill $hugo_pid
Shortcodes looks a strong tool, but I feel like this is a strong limitation of shortcodes. Am I using Hugo wrongly ? Should I do it in another way, or with another tool ?
Thanks