1

I’m building my site structure in React and DatoCMS like this:

projects/project-category/project-detail

And this is my query:

allProjects {
    slug
    projectCategoryParent {
      slug
    }
    genericPageParent {
      slug
    }
}

…can someone please point me in the right direction showing how to use getStaticPaths and getStaticProps in such a way that Project pages can be reached by joining all of the slugs together?

Thank you!

  • Does this help answer your question: https://stackoverflow.com/a/65553115/1870780? – juliomalves Feb 22 '21 at 21:22
  • Thank you! Yes, that's got the content loading on the Project detail page. How do I use the same method to load content on the Project Category page? I can see that using an index.js file is the way forward but I cannot access the correct props. – stevensunsunsun Feb 23 '21 at 11:33
  • 1
    All sorted now! Using a first level dynamic folder [category] with category.js; and a second level dynamic folder [project] and project.js Then params: { category: content.slug } and params: { category: content.projectCategoryParent.projectcategory, project: content.slug } respectively to query the relevant slugs. – stevensunsunsun Feb 24 '21 at 10:16

0 Answers0