Pagination for Results

The results retrieved from the prismic.io repository will automatically be paginated. Here you will find an explanation for how to modify the pagination parameters.

Before Reading

This page assumes that you've already imported the Prismic library and retrieved the api object. If you want to learn how to do this, then refer to the How to Query the API page.

pageSize

The pageSize option defines the maximum number of documents that the API will return for your query. Default is 20, max is 100.

Set the pageSize option as shown in the example below.

Example: This demonstrates how to query all of the documents of the custom type "recipe", allowing 100 documents per page.

Copy
api.query(
    Prismic.Predicates.at('document.type', 'recipe'),
    { pageSize : 100 }
).then(function(response) {
    // response is the response object, response.results holds the documents
});

page

The page option defines the pagination for the result of your query. If unspecified, this field defaults to "1", corresponding to the first page or results.

Set the page option as shown in the example below.

Example: This demonstrates how to query all of the documents of the custom type "recipe" limited to 50 recipes per page, showing the third page of results.

Copy
api.query(
    Prismic.Predicates.at('document.type', 'recipe'),
    { pageSize : 50, page : 3 }
).then(function(response) {
    // response is the response object, response.results holds the documents
});