Get associated data of the Link Object

Hi!

I'm currently using the PrismicRichText component from "@prismicio/react" library and I'm struggling with something (not related to the component API). Let me explain to you my problem:

I'm using NextJS, and I created a route as following:
/basePath/[...id]

The idea, is to be able to create a hierarchical content like this:
/basePath/slug1/slug2 etc.

The problem is, how to resolve it using the linkResolver? Especially because the document received (the same as the RichText component gets, or the same value when querying via graphQL) does not include the content type data.
So in order to pull the slugs of the parents, I need to be able to retrieve these informations from the link. Is there a proper way to do it?

Thanks!

Hi @Loki

Thanks for reaching out.

To me, it seems that what you are looking for are dynamic nested routes; if that is the case; then have you checked the Route Resolver documentation?

Hi Fares, thanks for the reply :pray:

Indeed I checked, however, the route resolver does not seem to be supporting the "catch all" routes right?

Or maybe I misunderstood. But I basically have my Page as a content type that can have a parent page. So I could end up with Page 6 child of Page 5, child of Page 4 etc.

I didn't find anything related to it on the documentation, but maybe I didn't look in the right place :slight_smile:

Thanks for the answer & the help :pray:

Well, it is not possible at the moment.

We Have an internal discussion about it; for the moment, a workaround would be to use multiple optional resolvers like this to achieve what you want, I think, but it'll be limited to 2 levels deep:

{
  type: "page",
  path: "/:grand_parent?/:parent?/:uid",
  resolvers: {
    parent: "parent",
    grand_parent: "parent.parent"
  }
}