linkResolver and nested paths


I’m building a complete guide for a website, with next JS and dynamic page.

I will have an architecture like this :

In an article, I have a content relationship to a chapter, and a chapter has its own content relation ship to hub.

In an article, I have a RichText element where we can have links to other Prismic document, for example a chapter or an article. Assume we want to go, for this need I add a relationship content in RichText editor.

Now if I need to make a correct link, I need to use linkResolver on RichText component.

But how to rebuild the full path to article page for exemple ? LinkResolver have only few attributes and it seems impossible to make a async call to get all datas I need to rebuild my specific path, and it seems weird to make a thing like this.


Hi Yoaan,

Unfortunately it’s not possible to do more than one level deep of nested threads at the moment.

That is to say you could have in the link resolver, by using fetchlinks:
NOTE: You must be using V2 of the api for this to work.

but not the more complex .

Although we are working on a new more intelligent link resolver, for the Static SSR technologies like Nuxt, Next & Gatsby, that would allow you to easily create complex nested URLs like this. I will be sure to keep you updated with the progress of this.

For now one solution that could work, though not perfect, is to use the document tags to create the third level, so in Prismic your tag on the document would be ‘hub’ then in the link resolver you could use that to create the third level.

if (
) {
  return `/hub/${}/${doc.uid}`

Then you would repeat this in the linkresolver for every parent category. I know it’s not great but until we release the new resolver it’s a good solution.

Let me know if you have any further questions about this.


Hey Phil,

Thanks for your answer. Infortunately, my hub and chapter are slug too and dynamic too :slight_smile:

And I already use fetchLinks, but I’m not sure that I got my chapter_link from my article in LinkResolver, I will check for this point.

Tag can be usefull, I can just add my tag which is same as my hub slug to simulate one level, not perfect :frowning:

Just check, I got my chapter_link in my article when I fetch one article.

But I don’t get it in my LinkResolver which analyze my content from my RichText element. Or am I missing something ?

Ah sorry I wasn’t clear. Your content relationship field needs to be a unique field in the top level of your document, you can’t get the content through a link in a Rich Text field.

Yes that’s my main problem, not accessing through a link in a Rich Text field :frowning:

Unfortunately that won’t be possible then.