mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Merge commit 'a6e635ca7d905d9ec3ffd708db2694f680b03aae'
This commit is contained in:
@@ -12,7 +12,9 @@ action:
|
||||
|
||||
[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers.
|
||||
|
||||
By default, the number of elements on each pager is determined by the value of the `paginate` setting in your site configuration. The default value is `10`. Override the value in your site configuration by providing a second argument, an integer, when calling the `Paginate` method.
|
||||
By default, the number of elements on each pager is determined by your [site configuration]. The default is `10`. Override that value by providing a second argument, an integer, when calling the `Paginate` method.
|
||||
|
||||
[site configuration]: /getting-started/configuration/#pagination
|
||||
|
||||
{{% note %}}
|
||||
There is also a `Paginator` method on `Page` objects, but it can neither filter nor sort the page collection.
|
||||
@@ -20,7 +22,12 @@ There is also a `Paginator` method on `Page` objects, but it can neither filter
|
||||
The `Paginate` method is more flexible.
|
||||
{{% /note %}}
|
||||
|
||||
You can invoke pagination on the home page template, [`section`] templates, [`taxonomy`] templates, and [`term`] templates.
|
||||
You can invoke pagination on the [home template], [section templates], [taxonomy templates], and [term templates].
|
||||
|
||||
[home template]: /templates/types/#home
|
||||
[section templates]: /templates/types/#section
|
||||
[taxonomy templates]: /templates/types/#taxonomy
|
||||
[term templates]: /templates/types/#term
|
||||
|
||||
{{< code file=layouts/_default/list.html >}}
|
||||
{{ $pages := where .Site.RegularPages "Section" "articles" }}
|
||||
@@ -37,14 +44,8 @@ In the example above, we:
|
||||
2. Sort the collection by title
|
||||
3. Paginate the collection, with 7 elements per pager
|
||||
4. Range over the paginated page collection, rendering a link to each page
|
||||
5. Call the internal "pagination" template to create the navigation links between pagers.
|
||||
5. Call the embedded pagination template to create navigation links between pagers
|
||||
|
||||
{{% note %}}
|
||||
Please note that the results of pagination are cached. Once you have invoked either the `Paginator` or `Paginate` method, the paginated collection is immutable. Additional invocations of these methods will have no effect.
|
||||
{{% /note %}}
|
||||
|
||||
[context]: /getting-started/glossary/#context
|
||||
[pagination]: /templates/pagination/
|
||||
[`section`]: /getting-started/glossary/#section
|
||||
[`taxonomy`]: /getting-started/glossary/#taxonomy
|
||||
[`term`]: /getting-started/glossary/#term
|
||||
|
Reference in New Issue
Block a user