Pagination
On this page
Snow supports pagination for sections and taxonomy terms.
Section Pagination
Enable pagination in front matter or configuration:
sections: posts: paginate: 10 paginate_filter_by: ""
| Option | Description |
|---|---|
paginate |
Items per page; 0 disables pagination (default) |
paginate_path |
Path template; selected automatically when unset |
paginate_filter_by |
Filter applied before pagination |
An unset or empty paginate_path uses page/{number}/ for directory-style paths and {name}{number}{extension} for file-style paths.
Taxonomy Term Pagination
taxonomies: tags: term: paginate: 10 paginate_filter_by: ""
Path Variables
| Variable | Meaning | Example |
|---|---|---|
{name} |
Base filename | index |
{extension} |
File extension | .html |
{number} |
Page number, starting at one | 1, 2, 3 |
Paths are relative to the section or term's path. The first page always uses that base path unchanged. paginate_path applies only to page two and later.
For directory paths ending in /, {name} is index and {extension} is .html. With /posts/ and {name}{number}{extension}, the first two paths are /posts/ and /posts/index2.html.
For file paths, subsequent pages retain the filename and extension. With /posts.html and {name}-{number}{extension}, the first two paths are /posts.html and /posts-2.html.
Examples
# Keep the base filename. path: "posts/" paginate_path: "{name}{number}{extension}" # First: /posts/ # Second: /posts/index2.html # Use a subdirectory. path: "posts/" paginate_path: "page/{number}{extension}" # First: /posts/ # Second: /posts/page/2.html # Default directory-style pagination. path: "posts/" paginate_path: "" # First: /posts/ # Second: /posts/page/2/ # Default file-style pagination. path: "posts.html" paginate_path: "" # First: /posts.html # Second: /posts2.html
Template Variables
| Property | Description |
|---|---|
paginator.Path |
Current page URL |
paginator.Permalink |
Current page absolute URL |
paginator.PageNum |
Current page number |
paginator.Total |
Number of pages |
paginator.HasPrev() |
Whether a previous page exists |
paginator.Prev.Path |
Previous page URL |
paginator.Prev.Permalink |
Previous page absolute URL |
paginator.HasNext() |
Whether a next page exists |
paginator.Next.Path |
Next page URL |
paginator.Next.Permalink |
Next page absolute URL |
paginator.First() |
First pager |
paginator.Last() |
Last pager |
paginator.Page(n) |
Pager for a given number |
paginator.Pagers |
All pagers |
paginator.Pages |
Content pages in the current pager |
{% if paginator.HasPrev() %} <a href="{{ paginator.Prev.Permalink }}">Previous</a> {% endif %} <span>{{ paginator.PageNum }} / {{ paginator.Total }}</span> {% if paginator.HasNext() %} <a href="{{ paginator.Next.Permalink }}">Next</a> {% endif %}