From 6f9db4a784a58c150863ada2cfd79090a0227d47 Mon Sep 17 00:00:00 2001 From: Tatsushi Demachi Date: Wed, 27 Aug 2014 22:50:06 +0900 Subject: [PATCH] Add document about page grouping functions --- docs/content/templates/list.md | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/content/templates/list.md b/docs/content/templates/list.md index 5fc14a0bb..41fa8675d 100644 --- a/docs/content/templates/list.md +++ b/docs/content/templates/list.md @@ -215,3 +215,39 @@ Can be applied to any of the above. Using Date for an example.
{{ .Date.Format "Mon, Jan 2, 2006" }}
{{ end }} + +## Grouping Content + +Hugo provides some grouping functions for list pages. You can use them to +group pages by Section, Date etc. + +Here are a variety of different ways you can group the content items in +your list templates: + +### Grouping by Page field + + {{ range .Data.Pages.GroupBy "Section" "asc" }} +

{{ .Key }}

+ + {{ end }} + +### Grouping by Page date + + {{ range .Data.Pages.GroupByDate "2006-01" "desc" }} +

{{ .Key }}

+ + {{ end }}