Create NoFollow Links in the Webflow Rich Text
Get the solution

Create NoFollow Links in the Webflow Rich Text

This script creates no follow links in the Webflow Rich Text container
1<script>
2// Add nofollow to specific links in Webflow Rich Text container
3
4document.addEventListener('DOMContentLoaded', function() {
5  const container = document.getElementById('blog__post__body');
6  if (container) {
7    const links = container.getElementsByTagName('a');
8    Array.from(links).forEach(link => {
9      const url = link.getAttribute('href');
10      if (url && url.includes('?nofollow')) {
11        link.setAttribute('rel', 'nofollow');
12      }
13    });
14  }
15});
16</script>
Tags:
js
code
Created by:
Digi2
Get the solution