Streaming live at 10am (PST)

Adding "rel=nofollow" to some links in CMS Rich Text fields

Hi, I’d like to have the ability to add rel=nofollow to some of my external links that in rich text fields in the CMS. There isn’t a way to do this out of the box so I’ve been looking for solutions and came across this forum post, I’ve tried to put the code in place that has been suggested but the links that I add #nofollow to aren’t having the additional attribute applied.

Can anyone help? I’m keen not to have dofollow links everywhere through my blog etc.

Thanks

If you don’t want the dofollow links, just don’t add them in with the script.

The each function works like so:

Do this, otherwise do that. If you just leave the else as blank then it won’t add it in.

if(url.includes(‘nofollow’)){
(this).attr( “rel”, “nofollow” );
}
else{

}

Make sure you’re checking the .webflow.io link to see if it works, also make sure the links is formatted the right way. Here is a link to my cacher snippet, perhaps it helps.

Great, thanks for coming back to me. I’ve just copied it from cacher and it works now so not sure what was happening yesterday. This is really helpful, thanks for the solution.

Cheers