To add a rel="nofollow" attribute to a link in HTML, you simply need to include the rel="nofollow" attribute within your anchor (<a>) tag. This tells search engines not to follow the link, which can be useful when you want to prevent passing link authority (or "link juice") to the destination page.
Example:
Original Link:
html
<a href="https://example.com">Visit Example</a>
Link with rel="nofollow":
html
<a href="https://example.com" rel="nofollow">Visit Example</a>
Explanation:
href="https://example.com": This is the destination URL.
rel="nofollow": This attribute tells search engines not to follow the link or pass any ranking value to the linked page.
Use Cases for rel="nofollow":
User-generated content: When you allow users to post links (e.g., comments, forums), using rel="nofollow" can prevent spammers from gaining SEO benefit from your site.
Paid links: If the link is part of an advertisement or sponsorship, using rel="nofollow" complies with search engine guidelines, as paid links shouldn't pass SEO value.
Untrusted content: If you're linking to an external site you don't fully trust or can't vouch for, adding rel="nofollow" helps prevent any association.