gatsby-uc / gatsby-source-strapi

Gatsby source plugin for building websites using Strapi as a data source
MIT License
354 stars 182 forks source link

Retrieving the next and previous siblings of current single type #318

Closed jasewarner closed 1 year ago

jasewarner commented 2 years ago

Hi there,

Can somebody point me in the right direction of how to retrieve the previous and next siblings of a single type?

This is a query that I'm working on (it's located in the template that displays the single type content), but obviously the next and previous entries are returning null because of the filter that's finding the right single type using its slug.

query ($slug: String) {
  allStrapiCaseStudy(filter: {Slug: { eq: $slug }}) {
    edges {
      previous {
        Title
      }
      node {
        Slug
        Title
      }
      next {
        Title
      }
    }
  }
  strapiCaseStudy(Slug: { eq: $slug }) {
    id
    strapi_id
    Slug
    Title
    Blocks {
      ... Blocks
    }
  }
}
moonmeister commented 1 year ago

Thanks for your interest in this project. This plugin is moving into the Gatsby User Collective and this repo will be archived. Please open an issue in that repository, submit a PR if you'd like to see this implemented, or join us on Discord if you have questions!