Sometimes, you need to be able to mark some links on your website as nofollow, but how do you do it when using Sanity and SvelteKit? This quickguide will show you how.
(This guide assumes you're using TypeScript, adjust it if you're using vanilla JavaScript)
First, edit your block content Sanity schema, assuming it looks something like this:
We add the annotations, like below:
Here we're making it so we include the URL, but also a custom nofollow radio button.
Now in your SvelteKit project, create a new file called Link.svelte I've placed mine in the src/lib/components/portable-text directory.
Now to finish, modify where you're outputting your PortableText component, to look something like this:
And there you have it, you should now be able to mark your links as nofollow when adding a link.
If you found this article useful, please share it with your friends :)