Hi,
I have the following code in my “index.html” and it’s working just fine, from within a “range” so $index is correctly incrementing with each page that’s being iterated.
{{ if eq $index 0 }}
{{ $.Scratch.Set "colSpan" 4 }}
{{ $.Scratch.Set "rowSpan" 4 }}
{{ else if in $index 1 }}
{{ $.Scratch.Set "colSpan" 2 }}
{{ $.Scratch.Set "rowSpan" 2 }}
{{ else if in $index 2 }}
{{ $.Scratch.Set "colSpan" 2 }}
{{ $.Scratch.Set "rowSpan" 2 }}
{{ else }}
{{ $.Scratch.Set "colSpan" 1 }}
{{ $.Scratch.Set "rowSpan" 1 }}
{{ end }}
It lets my highlight my latest posts, showing the first page with a 4x4 size, the next two with 2x2 size, and everything older than that with a 1x1 size.
Is there a way to use the “if in $index …” in a way that means I don’t have to have a separate if/else clause for both of the 2x2 options? Something like “if in $index (1 2)”? I’ve tried that and it doesn’t work.