Different html on layout summary based on iteration index

Hi,

My layout/members/summary.html has the following code:

<p> The name is: {{ .Params.name }}
<p> Bio: {{ .Params.bio }}
<hr>

I want to be able to change the order of the first two elements depending
on the iteration number. Basically, the first iteration should render as
above and in the second iteration I should render:

<p> Bio: {{ .Params.bio }}
<p> The name is: {{ .Params.name }}
<hr>

The first and second p elements are swapped.

How would you go on doing that?

Thank you all!
-drd

I realized that I have indexes/members.html which contains:

{{ range .Data.Pages }}
	{{ .Render "summary" }}
{{ end }}

And that iterates over all the members and renders the other layout (layouts/members/summary.html).

I have tried to render a different html based on the index at the indexes level but
I haven’t been able to make it work.

Any help is welcome.

Thanks again,
-drd

This is how I am doing it right now:

{{ range $index, $element := .Data.Pages }}
  {{ if modBool $index 2 }}
	  {{ .Render "summary-first" }}
  {{ else }}
	  {{ .Render "summary-second" }}
  {{ end }}
{{ end }}