From a3c06dbb033d10c08550697722f3e934cecfc73e Mon Sep 17 00:00:00 2001 From: Brandon Fancher Date: Fri, 28 Jun 2019 11:46:53 -0400 Subject: [PATCH] feat: add direct support for referencing next and prev pages --- packages/gatsby-source-prismic-graphql/src/gatsby-node.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/gatsby-source-prismic-graphql/src/gatsby-node.ts b/packages/gatsby-source-prismic-graphql/src/gatsby-node.ts index 73c797537..62f8e0c1e 100755 --- a/packages/gatsby-source-prismic-graphql/src/gatsby-node.ts +++ b/packages/gatsby-source-prismic-graphql/src/gatsby-node.ts @@ -55,6 +55,7 @@ const getPagesQuery = ({ pageType }: { pageType: string }) => ` id lang uid + type alternateLanguages { id lang @@ -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 : '', },