--- layout: docs title: Pagination prev_section: permalinks next_section: plugins --- 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 has pagination built-in, so you can automatically generate the appropriate files and folders you need for paginated post listings.
Pagination does not work with Markdown or Textile files in your Jekyll site. It will only work when used within HTML files. Since you’ll likely be using this for the list of posts, this probably won’t be an issue.
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.
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.
{{ "{% if paginator.previous_page == 1 " }}%} Previous {{ "{% else " }}%} Previous {{ "{% endif " }}%}
{{ "{% else " }}%}Previous
{{ "{% endif " }}%}Next
{{ "{% endif " }}%}