nuotsu / sanitypress

Next.js + Sanity.io Stater Template with Tailwind CSS
https://sanitypress.dev
MIT License
36 stars 10 forks source link

Any plans for nested pages #11

Open liamb13 opened 1 week ago

liamb13 commented 1 week ago

Could be nice to have the option for deeply nested pages.

As an example:

nuotsu commented 1 week ago

Thanks for the great suggestion. I may have to make a switch to use Catch-all Segments in Next.js routing, but I do see the value in having nested routing implemented natively.

I'll make sure to have documentation once I have a stable solution for this

liamb13 commented 1 week ago

Just spent a while playing around with the Studio experience, based on all the different approaches people have tried. Shout outs to: René, Emma, Simeon, and Mathieu.

I landed on this:

image

Found it's a nice middle ground between displaying a hierarchy and not ending up with endless nesting.

Feel free to use what you like, although it still needs some clean up: https://github.com/liamb13/sanitypress/commit/301c7e4ae6c9ae309e3ef274837211bd3dd83a29

One change I haven't got around to is separating the auto-generated slug from an editable slug. I think it'd be nice to still have the option to change the current documents slug, and still have an auto-generated version with all the prefixing.

So for the document /services/design/ui-design, the ui-design part could be edited or generated from the title, but the /services/design/would be read-only.

nuotsu commented 1 week ago

I do like this approach and the way it's organized in the Studio, but do feel like it adds a bit more complexity than I'd like to this "starter" template.

I just published an article on nested routes. I've provided 2 options for now and mentioned the above setup in the article—I'll let users decide which method they'd prefer to use.