--- layout: docs title: Pagination permalink: /docs/pagination/ --- With many websites — especially blogs — it’s very common to break the main listing of posts up into smaller lists and display them over multiple pages. Jekyll offers a pagination plugin, so you can automatically generate the appropriate files and folders you need for paginated listings. For Jekyll 3, include the `jekyll-paginate` plugin in your Gemfile and in your `_config.yml` under `gems`. For Jekyll 2, this is standard.
Pagination does not work from within Markdown or Textile files from
your Jekyll site. Pagination works when called from within the HTML
file, named index.html
, which optionally may reside in and
produce pagination from within a subdirectory, via the
paginate_path
configuration value.
Setting a permalink in the front matter of your blog page will cause pagination to break. Just omit the permalink.
Attribute | Description |
---|---|
|
current page number |
|
number of posts per page |
|
a list of posts for the current page |
|
total number of posts in the site |
|
number of pagination pages |
|
page number of the previous pagination page,
or |
|
path of previous pagination page,
or |
|
page number of the next pagination page,
or |
|
path of next pagination page,
or |
Pagination pages through every post in the posts
variable regardless of variables defined in the YAML Front Matter of
each. It does not currently allow paging over groups of posts linked
by a common tag or category. It cannot include any collection of
documents because it is restricted to posts.
Jekyll does not generate a ‘page1’ folder, so the above code will not work
when a /page1
link is produced. See below for a way to handle
this if it’s a problem for you.