I have a "URL schema"-type in Prismic, that defines the parent part of my slug that I want to use, for every content type.
My issue is that in my Link Resolver I don't have access to anything other than the "doc", and my URL schema is neither a field on the "doc" or related to the "doc" through a Content Relationship field.
My URL structure like this:
/en/articles/:uid
/da/artikler/:uid
I want to get the "articles" part of the URL from Prismic (URL schema), but since I don't have access to anything other than the doc inside my Link Resolver, I don't see how to retrieve this data in a good way.
I've tried to play around with the Router Resolver, however that too also only gives me access to content related to a Content Relations-field.
We can take the current URL from the respective _uid.vue in the code and then can path the string "articles" or "artikler" from there in a variable and then you can get those variable values in link-resolver to create the URL.
For example:
You will have 2 hierarchies in your code, where you can add the variable:
/pages/articles/_uid.vue
Please add the variable like parent_type in the the respective response objects, which you are using to pass in link-resolver: response.parent_type="articles"
/pages/artikler/_uid.vue
Please add the variable like parent_type in the respective response objects, which you are using to pass in link-resolver: response.parent_type="artikler"
And you can get this in Link-resolver as doc.parent_type to make the URL.
We have similar example screenshots of adding a variable to 1 and 2
Please let me know if we have the same understanding here.
Thank you,
Priyanka
system
(system)
closed as resolved, flag & select 'Something Else' to reopen.
4
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.