We have a model called Page which can be used to created nested pages:
- one
-- two
--- three
On the frontend, this results in a URI like /one/two/three. Is there a way to query for a model using the full URI/nested slug? If not, how would we fetch three from the CMS based only on the URI? Assuming the depth could be anywhere between 1-6 and there could be multiple pages with a matching slug at different depths.
Hey Stefano, thanks for getting back to me so quickly.
Is this something that is on the roadmap? It seems like something that would be super useful for any site using datocms as a source for nested content pages.
Do you mean by fetching all the pages, constructing the URIs and doing a lookup? Will there be any performance issues if there are a lot of pages?
Regarding the performance, how many records do you plan to have? You can fetch 500 records per call.
Then you would need to rebuild the tree on your end and traverse it to find the content that you need. I’m not sure, but I don’t think it will be very time consuming. On the plus side, once you have the tree on your end the traversals would be much faster than calling an API though.