GroupByParam
Syntax
PAGES.GroupByParam PARAM [SORT]
Returns
page.PagesGroup
对于可选的排序顺序,请指定 asc
表示升序,或 desc
表示降序。
{{ range .Pages.GroupByParam "color" }}
<p>{{ .Key | title }}</p>
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}
按降序排列分组:
{{ range .Pages.GroupByParam "color" "desc" }}
<p>{{ .Key | title }}</p>
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}