mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Merge commit 'f96384a3b596f9bc0a3a035970b09b2c601f0ccb'
This commit is contained in:
@@ -2,16 +2,13 @@
|
||||
title: Pagination
|
||||
linktitle: Pagination
|
||||
description: Hugo supports pagination for your homepage, section pages, and taxonomies.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
categories: [templates]
|
||||
keywords: [lists,sections,pagination]
|
||||
menu:
|
||||
docs:
|
||||
parent: "templates"
|
||||
parent: templates
|
||||
weight: 140
|
||||
weight: 140
|
||||
sections_weight: 140
|
||||
aliases: [/extras/pagination,/doc/pagination/]
|
||||
toc: true
|
||||
---
|
||||
@@ -34,9 +31,9 @@ Setting `paginate` to a positive value will split the list pages for the homepag
|
||||
|
||||
## List Paginator Pages
|
||||
|
||||
{{% warning %}}
|
||||
{{% note %}}
|
||||
`.Paginator` is provided to help you build a pager menu. This feature is currently only supported on homepage and list pages (i.e., taxonomies and section lists).
|
||||
{{% /warning %}}
|
||||
{{% /note %}}
|
||||
|
||||
There are two ways to configure and use a `.Paginator`:
|
||||
|
||||
@@ -59,7 +56,7 @@ The global page size setting (`Paginate`) can be overridden by providing a posit
|
||||
It is also possible to use the `GroupBy` functions in combination with pagination:
|
||||
|
||||
```go-html-template
|
||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||
```
|
||||
|
||||
## Build the navigation
|
||||
@@ -72,7 +69,7 @@ The easiest way to add this to your pages is to include the built-in template (w
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
```
|
||||
|
||||
{{% note "When to Create `.Paginator`" %}}
|
||||
{{% note %}}
|
||||
If you use any filters or ordering functions to create your `.Paginator` *and* you want the navigation buttons to be shown before the page listing, you must create the `.Paginator` before it's used.
|
||||
{{% /note %}}
|
||||
|
||||
|
Reference in New Issue
Block a user