I am trying to capture some content generated in my page, store it in the Page.Scratch, and then read it out in the template.
If I edit any of the files involved in this process, everything generates as expected. If I edit any other file, my Scratch ends up empty in the template.
From the .md file
{{<toScratch "callout">}}
{{<ipad-callout class="card-ipad-grey-small" title="Helpful Hints and Additional Resources">}}
These boxes include helpful hints and additional resources relevant to the page content throughout the course.
{{</ipad-callout>}}
{{</toScratch>}}
The toScratch shortcode simply saves to the pages scratch. The param is the key name of the scratch.
I’ve read about rendering nested shortcodes inside->out, which I’m doing. I’ve also read about race conditions created by the parallel nature of Hugo. I suspect that this is what I’ve run into. Is there a better way to pass the content up to the template?
So I tried setting the Scratch in a partial instead of the shortcode. So page->shortcode->partial. And it seems to work. Can anyone explain why?
Page.md
{{<toScratch "callout">}}
{{<ipad-callout class="card-ipad-grey-small" title="Helpful Hints and Additional Resources">}}
These boxes include helpful hints and additional resources relevant to the page content throughout the course.
{{</ipad-callout>}}
{{</toScratch>}}
The shortcode apparently doesn’t always render when using hugo in server mode. When I do a full build, it is fine.
But the suggested fix in the linked issue (use .Content before accessing the .Scratch created by running content) don’t apply, as I was doing so already.