Vincent07
(Vincent Blondaux)
1
Hi!
On my SliceMachine, i created a Link field:
On prismic, the client has linked to another Page (uid : contact)
On my HTML:
<PrismicLink :field="slice.primary.btn_link" tab-index="-1" class="button">
{{ slice.primary.btn_label}}
</PrismicLink>
But when rendering (i displayed the {{ slice.primary.btn_linkg }} above)
Any ideas?
Thanks a lot!
Vincent
jake
(Jake Walters)
2
Hi Vincent,
I don't quite understand what the problem is.
I can see that the link UID is contact
which is the linked document in Prismic.
What is your expected behaviour?
Vincent07
(Vincent Blondaux)
3
Indeed, but the link of the button is not contact :(
jake
(Jake Walters)
4
Ah sorry yes!
have you setup a link resolver?
can you share your route resolver too?
That'll likely be why it's linking to another document.
Vincent07
(Vincent Blondaux)
6
Hi Jake,
I haven't any Link Resolver.
It's not linking to another document, it's the slug of the actual page, where the button is.
My code:
<PrismicLink :field="slice.primary.btn_link" tab-index="-1" class="button">
{{ slice.primary.btn_label}}
</PrismicLink>
HTML Render:
<a tab-index="-1" href="" class="button">
Contacter l'agence pour en discuter
</a>
I juste create some Routes Resolver for dynamic pages / slug:
prismic: {
endpoint: apiEndpoint,
modern: true,
/* see configuration for more */
apiOptions: {
routes: [
// Resolves the Homepage document to "/"
{
type: 'homepage',
path: '/',
},
{
type: 'article',
path: '/blog/:category/:uid',
resolvers: {
category: 'category'
}
},
{
type: 'client',
path: '/cas-clients/:uid'
},
{
type: 'landing_page',
path: '/:category/:uid',
resolvers: {
category: 'category'
}
},
],
},
},
The Contact Page is a simple page, i don't understand
(thanks for your time )
jake
(Jake Walters)
7
Ok thanks Vincent
Try adding another route resolver rule for your new document type
{
type: 'pagecontent',
path: '/:uid'
}
Let me know how you get on :)
Vincent07
(Vincent Blondaux)
8
I'm think i'm stupid!
It was just that...
Thanks a lot!
1 Like