Q42 / sanity-plugin-page-tree

MIT License
23 stars 3 forks source link

Feature request: Add max depth config option #15

Open magicspon opened 6 months ago

magicspon commented 6 months ago

It would be good to be able to prevent authors from nesting to far.

It'll also mean i can have a fixed depth in my groq query and be confident that I've got all the required slugs.

djohalo2 commented 1 month ago

Hi @magicspon. With the provided clients from the package the idea is that nesting should not be a limiting factor for resolving a page. We fetch all the pages query time and then client-side or server-side construct the page tree itself to resolve a page by a path.

I think such an option could be possible to support, but I think it should not be necessary. Would you mind sharing a bit more on your setup? Maybe something can be changed there to fix this in another way.

magicspon commented 1 month ago

The main reason I ask is I'd like to known how deep I need to go to generate urls for links

See this query as an example

https://github.com/magicspon/sanity-next-mono/blob/main/apps/cms/queries/fragments/link.fragment.ts