Scenario: Get a set of pages, iterate over them, rendering a layout. The layout should render specific classes to swap the order of elements.
Problem: $order is always set to order-1. Additionally, when running printf "%s" I get <nil> for both $idx and $.Scratch.Get "index"
index.html
// Set index to 0
{{ $.Scratch.Set "index" 0 }}
{{ range first 6 (sort $solutions ".Params.weight") }}
// Bump index by 1
{{ $.Scratch.Set "index" (add (int (.Scratch.Get "index")) 1) }}
// Render the summary.html layout
{{ .Render "summary"}}
{{ end }}
summary.html
{{ $idx := $.Scratch.Get "index" }}
{{ if modBool $idx 2 }}
{{ $.Scratch.Set "solutions-order" "order-1" }}
{{ else }}
{{ $.Scratch.Set "solutions-order" "" }}
{{ end }}
{{ $order:= $.Scratch.Get "solutions-order" }}
...
<div class="{{ $order }}">
Content that should take order-1
</div>