Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
feat: add direct support for referencing next and prev pages
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonfancher committed Jul 12, 2019
1 parent 3438f01 commit a3c06db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/gatsby-source-prismic-graphql/src/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const getPagesQuery = ({ pageType }: { pageType: string }) => `
id
lang
uid
type
alternateLanguages {
id
lang
Expand Down Expand Up @@ -161,6 +162,8 @@ function createPagesFromEdges(
...node._meta,
cursor,
// would it be better to also include cursor or uid for prev and next pages?
prevPageMeta: edges[index - 1] ? edges[index - 1].node._meta : null,
nextPageMeta: edges[index + 1] ? edges[index + 1].node._meta : null,
// lastPageEndCursor: index === 0 ? lastEndCursor : endCursor, // for paging back
lastPageEndCursor: edges[index - 1] ? edges[index - 1].endCursor : '',
},
Expand Down

0 comments on commit a3c06db

Please sign in to comment.