Closed imacrayon closed 2 years ago
Are you using the Runtime parser?
Correct, version
is set to runtime
.
Any ideas on this one @JohnathonKoster?
Can we just clear the stack when the stack tag is used?
Can we just clear the stack when the stack tag is used?
We could but would make it impossible to use the stack in two spots (use case: push items to a navigation and a table of contents without needing two stacks. Relatively niche but would be super useful if this PR that lets you access stacks as an array is merged: https://github.com/statamic/cms/pull/6110/).
I will look into adding it at this point: https://github.com/statamic/cms/blob/3.3/src/View/View.php#L112 if you want them to be usable more than once. This is the relevant methods that would be used: https://github.com/statamic/cms/blob/3.3/src/View/Antlers/Language/Runtime/StackReplacementManager.php#L10
I have a
{{ stack:scripts }}
tag in my main layout and a few pages with:When my site is server rendered, stacks work as expected, I see a single
<script>
tag rendered in my layout. However when I run SSG the same page will end up with repeated script tags like this:It appears that the same stack is repeatedly pushed to on every page that SSG creates. I think the stacking context needs to be cleared before each new page is rendered.