A page displaying a list of content gets longer as the amount of content grows. Pagination is the technique of spreading that content across multiple pages.
The goal of pagination is to create multiple pages (from a single template) that show a limited number of items.
Each page will query GraphQL for those specific items.
The code above will create an amount of pages that is based on the total number of posts. Each page will list
postsPerPage(6) posts, until there are less than
postsPerPage(6) posts left.
The path for the first page is
/blog, following pages will have a path of the form:
Follow this step-by-step tutorial to add links to the previous/next page and the traditional page-navigation at the bottom of the page
Edit this page on GitHub