1---
2title: group
3description: "`group` groups a list of pages."
4date: 2018-09-14
5categories: [functions]
6menu:
7  docs:
8    parent: "functions"
9keywords: [collections]
10signature: ["PAGES | group KEY"]
11hugoversion: "0.49"
12---
13
14{{< code file="layouts/partials/groups.html" >}}
15{{ $new := .Site.RegularPages | first 10 | group "New" }}
16{{ $old := .Site.RegularPages | last 10 | group "Old" }}
17{{ $groups := slice $new $old }}
18{{ range $groups }}
19<h3>{{ .Key }}{{/* Prints "New", "Old" */}}</h3>
20<ul>
21    {{ range .Pages }}
22    <li>
23    <a href="{{ .Permalink }}">{{ .Title }}</a>
24    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
25    </li>
26    {{ end }}
27</ul>
28{{ end }}
29{{< /code >}}
30
31
32
33The page group you get from `group` is of the same type you get from the built-in [group methods](/templates/lists#group-content) in Hugo. The above example can even be [paginated](/templates/pagination/#list-paginator-pages).
34
35
36
37
38