GroupByParam
Syntax
PAGES.GroupByParam PARAM [SORT]
Returns
page.PagesGroup
For the optional sort order, specify either asc
for ascending order, or desc
for descending order.
{{ range .Pages.GroupByParam "color" }}
<p>{{ .Key | title }}</p>
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}
To sort the groups in descending order:
{{ range .Pages.GroupByParam "color" "desc" }}
<p>{{ .Key | title }}</p>
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}