Customise links

Hello team,

for SEO purposes we need to be able to set some specific properties to links (wether to web or to prismic documents). From Prismic we would like to add a property to links so we can specify which links are "a" tags and which ones are javascript links (with no SEO value). This is needed to optimise our SEO strategy. How would you go about this in Prismic ?

From what I see this is not possible out of the box. What would be the best practice ? I'm thinking of adding a keyword like [no_seo] in the anchor so this gets transformed at build time on the gatsby side. What do you think ?

Many thanks,

Valentin

Hello @valentin,

Thank you for reaching out to us.

If you use the Rich text editor and use links inside it, you can add some query parameters to the links. You can use an HTML serializer to check the query param for rich text for filtering links in the code.

For example, if you add different links in your Prismic rich text with a param no_seo on the front end in the HTML serializer, you can add/modify the a tags for that filtering.

Find complete detail in the HTML Serializer guide. It's in Javascript, but you can find it in other frameworks too.

Here is an article about it.

Let me know if you have any doubt.

Thanks,
Priyanka

Hello Priyanka,

Thanks for your answer.
@team-education

This ignores one critical point I think : links to Prismic documents cannot be edited, so I cannot add a query param to these. Do you suggest we use a keyword directly in the anchor tag rather than in the URL then ? The keyword will be removed by the html serializer. Honestly, this is a hack that will make our use of Prismic more complicated going forward.

Thanks,

Valentin

The other option would be when modelling your data to always add a select box dropdown beside the links for you writers to specify this information. You would then use the info of that dropdown in your application.

As you've seen it's not currently something offered with our standard link component. I will add this to our feature request tracker for the team to see.

Although this is the first request we've had for this functionality it will be very low down the queue in terms of priority. If this is ever considered to be worked on the team will update you here.

Other users can show support for this feature using the 'heart' button.

Hello Phil,

Thanks for making this a feature request, but this doesn't solve my issue today.

How do you suggest I work around this today?

Can I add a keyword like **no_seo** or **hidden** in the anchor tag so this gets transformed at build time with the html serializer ?

Many thanks,

Valentin

Unfortunately, in terms of adding keywords to Prismic links there is no good workaround at the minute, because even if you managed to set something up for link fields there's nothing you can do for links inside the rich text field.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.