I've seem other GraphQL APIs on CMSs provide prev and next connections on a node edge. This would be helpful in my case for creating page level navigation for next post and previous post. I've solved this in JS for now but it would be nice for these to be available in query. It would look something like:
query {
posts {
edges {
next {
#WpGraphql_Post
}
prev {
#WpGraphql_Post
}
node {
#WpGraphql_Post
}
}
}
}
@moonmeister I have a GIST that _may_ apply here: https://gist.github.com/jasonbahl/55a6eff4cd67ce639ecd2d9989fef4cc
I've been thinking about adding support for this, but haven't landed on an ideal implementation. I plan on doing some work on Connections in an upcoming release, so this could be a good time to dive more into this.
That gist is for older version of WP-GQL I think, this is an updated version that we use all the time: https://github.com/funkhaus/stackhaus-backend/blob/master/functions/gql-functions.php#L32-L146
@drewbaker am curious which file do you add that code in your gist?
In your themes functions.php file
Most helpful comment
That gist is for older version of WP-GQL I think, this is an updated version that we use all the time: https://github.com/funkhaus/stackhaus-backend/blob/master/functions/gql-functions.php#L32-L146