I am using Bep’s 2017 suggestion to do something different on odd list.html .Summary:

{{ range $i,$p := where .Data.Pages “Section” “services” }}
{{if not (modBool $i 2)}}
it’s odd

However, $i needs to be passed on to {{ Render “summary” }} which I cannot achieve (and it may not be possible here unlike a partial).

I solved the issue now by copying the summary.html code into the list.html page but I am still curious if there is a better solution.

You would have to use a partial instead of a content view.

{{ partial "my-partial.html" (dict "page" . "myVar" $myVar)

If the partial needs to be dynamically selected…

{{ partial (printf "%s.html" $myPartial) (dict "page" . "myVar" $myVar) }}

Within the partial…

{{ .page.Title }}
{{ .myVar }}
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.