Open In App

How to Find & Add Nofollow Links to your Website in HTML ?

The nofollow attribute in links is a crucial tool for controlling how search engine crawlers interact with your website's content. By adding the nofollow attribute to specific links, you instruct search engine bots not to follow those links, preventing them from spreading content to linked pages. This helps control spam and can improve your website's page rank in search engine results.

In this approach, The HTML code defines a webpage containing an article about nofollow links, there is a hyperlink leading to "https://google.com" with the nofollow attribute specified in the rel attribute. This indicates that search engine crawlers should not follow the link. Now, Open browser developer tools by right-clicking on the website and selecting Inspect Element. Then, press CTRL + F to search for nofollow and find all links with this attribute set, revealing the number of anchor tags marked as nofollow.

Example: The below example shows How to Find Nofollow Links to Your Website in HTML.

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Nofollow links</title>
</head>

<body>
    Article for Nofollow links
    <a href="https://google.com" 
       rel="nofollow">
      This is a nofollow link
      </a>
</body>

</html>

Output:

nofollow

In this approach, The HTML structure includes a paragraph, a button, and an anchor tag. JavaScript adds an event listener to the button to modify the anchor tag's attributes. Upon button click, the script adds the "nofollow" attribute to the anchor tag, preventing crawlers from following the link.

Example: The example below shows how to Add Nofollow Links to Your Website in HTML.

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Nofollow links</title>
</head>

<body>
    <p>Article for Nofollow links</p>
    <button id="button" 
            style="display: block;">
          Click to add nofollow attribute 
          to the below link!
      </button>
    <a href="https://google.com">
      This is a nofollow link
      </a>
</body>

<script>
    const button = document.getElementById('button');
    const link = document.querySelector('a');

    button.addEventListener('click', () => {
        link.setAttribute('rel', 'nofollow');
    });
</script>

</html>

Output:

nofolllow

Article Tags :