Sub topic 6
nofollow, sponsored, and ugc: telling search engines how you relate to a link
This chapter assumes you can read basic HTML, know what an anchor tag is, and understand that search engines treat links as a signal of importance. Here you will learn the three rel values that describe how you relate to a link, and when to use each one.
Why link attributes exist
A link normally acts as a vote. The linking page passes some trust to the target, and the search engine counts it. That works only if the vote is honest. Paid links, spammy comments, and forum signatures all produce votes the site owner did not really choose.
The rel attribute lets the linking site say how it relates to the target. Google introduced nofollow in 2005 to fight comment spam. In 2019 it added sponsored and ugc so that site owners could be more specific.
The three values
| Value | Use it for | Example situation |
|---|---|---|
| `nofollow` | Links you do not want to vouch for, with no more specific reason | A link to a page you mention as a bad example |
| `sponsored` | Paid placements, advertisements, affiliate links, and other compensated links | A partner pays for a link in your article |
| `ugc` | Links inside user-generated content | A reader's link in a comment or forum post |
You can combine values by separating them with spaces. The rel attribute accepts a space-separated list.
<!-- Paid placement -->
<a href="https://example.com/product" rel="sponsored">Partner product</a>
<!-- Link in a user comment or forum post -->
<a href="https://example.com/post" rel="ugc">A commenter's link</a>
<!-- Several values can be combined -->
<a href="https://example.com/offer" rel="sponsored nofollow">Offer</a>A link with none of these values is a normal link. You are vouching for the target, and the search engine may use the link as a ranking signal.
How search engines treat these values
Since March 2020, Google treats all three values as hints, not as strict commands. Before that, nofollow was a directive that Google always obeyed. Now Google may choose to use a marked link for crawling, indexing, or ranking, though in most cases it will not pass ranking credit.
This has two consequences:
- Marking a link does not guarantee it is ignored. Mark links because it is accurate, not as a way to control a result.
- Other search engines may handle the values differently. Check their documentation if they matter to you.
From the target's side, a backlink with one of these values usually contributes little or nothing to ranking. It can still bring referral traffic, and it can still help a crawler discover your page.
Choosing a value
Ask what the relationship is, and pick the most specific value that fits.
Some rules of thumb:
- If money, free products, or any other compensation is involved, use
sponsored. This includes affiliate links. - If visitors can post the link, use
ugc. Many content management systems add it automatically to comments, so check your own templates. - If you cannot vouch for the target for any other reason, use
nofollow. - If you would recommend the target without any outside influence, leave the link unmarked.
Seeing the attributes the way a crawler does
A crawler records rel values alongside the URL and anchor text. This script lists every link on a snippet of HTML with its rel values, which are the raw facts a search engine stores about a link.
from html.parser import HTMLParser
class LinkCollector(HTMLParser):
"""Collect href, rel values, and anchor text for every <a> tag."""
def __init__(self):
super().__init__()
self.links = []
self._current = None
def handle_starttag(self, tag, attrs):
if tag == "a":
attributes = dict(attrs)
if "href" in attributes:
self._current = {
"href": attributes["href"],
"rel": (attributes.get("rel") or "").split(),
"text": "",
}
def handle_data(self, data):
if self._current is not None:
self._current["text"] += data
def handle_endtag(self, tag):
if tag == "a" and self._current is not None:
self._current["text"] = self._current["text"].strip()
self.links.append(self._current)
self._current = None
html = '<p>Read the <a href="https://example.com/guide">SEO guide</a> and <a href="https://example.org/ad" rel="sponsored nofollow">this offer</a>.</p>'
parser = LinkCollector()
parser.feed(html)
for link in parser.links:
print(link)The first link has an empty rel list, so it is a normal link. The second has ["sponsored", "nofollow"].
Common errors
- Leaving paid links unmarked. Buying or selling links that pass ranking credit violates Google's link spam policies. Use
sponsored. - Using
nofollowfor everything. Marking all outgoing links removes your votes from pages you really do recommend. Reserve it for links you do not vouch for. - Marking internal navigation. Adding
nofollowto links between your own pages does not help and can hide pages from crawling signals. Internal links are usually left normal. - Assuming
nofollowblocks indexing. The attribute describes one link. It does not stop the target from being crawled or indexed through other routes. To control indexing, use anoindexrobots meta tag or anX-Robots-Tagheader on the target page. - Forgetting the markup is on the linking page. You set the value on the page that contains the link. As the owner of the target, you cannot add it to links that others place.
Exercise
A blogger writes a review of a headphone brand. The brand sent the blogger free headphones in exchange for the review and a link to its store. Which rel value should the link use, and does it matter that the blogger genuinely likes the product?
Show answer
Use rel="sponsored", or rel="sponsored nofollow" if you want both values. The free product is compensation, so the link is sponsored regardless of whether the opinion is sincere. Honest enthusiasm does not change the commercial relationship.
Exercise
A visitor posts a comment on your blog with a link to their own site. Name the value your comment system should add, and say whether Google is guaranteed to ignore the link for ranking.
Show answer
It should add rel="ugc". Google is not guaranteed to ignore it, because since 2020 ugc, sponsored, and nofollow are treated as hints. In most cases the link passes little or no ranking credit.