Sub topic 12
Anchor Text Mistakes and Link Attributes
This chapter assumes you can write a elements with href, and that you know what descriptive anchor text is. It covers the ways anchor text goes wrong and the rel attributes that change how a link is treated.
Common anchor text mistakes
Search engines read anchor text as a short description of the target page. Most mistakes make that description useless or suspicious.
- Generic anchors. "Click here", "read more", and "this page" say nothing about the target. Replace them with words that name the topic.
- Empty anchors. A link that wraps only an image with no
alttext has no description at all. When an image is the link, itsalttext acts as the anchor text. - Naked URLs. Using
https://example.com/guides/url-slugs/as the link text is readable by people but weak as a description. - Over-optimized anchors. If every link to a page uses the same exact keyword phrase, the pattern looks manipulative. Vary the wording the way a writer naturally would.
- Mismatched anchors. The anchor promises one thing and the page delivers another. Readers leave, and the description misleads search engines.
- Overlong anchors. Whole sentences as anchor text dilute the description. Aim for a short phrase of about two to six words.
- One anchor, many targets. If "SEO guide" points to three different pages, none of them gets a clear description.
<!-- Weak -->
<a href="/guides/url-slugs/">click here</a>
<!-- Over-optimized when repeated on every page -->
<a href="/guides/url-slugs/">best url slugs seo guide best slugs</a>
<!-- Natural and descriptive -->
<a href="/guides/url-slugs/">how to write URL slugs</a>Finding weak anchors with a script
A small parser can flag generic, empty, or URL-style anchors. This reuses the idea from the link collector in the crawlable markup chapter.
from html.parser import HTMLParser
GENERIC = {"click here", "here", "read more", "more", "learn more", "this page", "link"}
class AnchorAudit(HTMLParser):
def __init__(self):
super().__init__()
self.findings = []
self._href = None
self._text = []
def handle_starttag(self, tag, attrs):
if tag == "a":
self._href = dict(attrs).get("href")
self._text = []
def handle_data(self, data):
if self._href is not None:
self._text.append(data)
def handle_endtag(self, tag):
if tag == "a" and self._href is not None:
anchor = " ".join("".join(self._text).split()).lower()
if anchor in GENERIC or anchor == "" or anchor.startswith("http"):
self.findings.append((self._href, anchor))
self._href = None
audit = AnchorAudit()
audit.feed('<a href="/more/">Click here</a> <a href="/guides/slugs/"><img src="a.png"></a>')
print(audit.findings) # [('/more/', 'click here'), ('/guides/slugs/', '')]An empty result for an image link is only a prompt to check the image's alt text. The script does not read it.
Link attributes
The rel attribute tells search engines how to treat a link. Google treats these values as hints, not commands.
| Attribute | Meaning | Typical use |
|---|---|---|
| `rel="nofollow"` | Do not vouch for the target | Links you do not want to endorse |
| `rel="sponsored"` | The link is paid or an ad | Sponsored posts, affiliate links |
| `rel="ugc"` | Link comes from user-generated content | Comments, forum posts |
| `target="_blank"` | Open in a new tab | Usability only, no SEO effect |
<a href="https://partner.example/offer" rel="sponsored">partner offer</a>
<a href="https://example.org/post" rel="ugc nofollow">commenter's link</a>You can combine values, separated by spaces.
Fixing the problems
- Run an audit like the one above across your templates, not only your articles. Navigation, footers, and "related posts" widgets often produce thousands of generic anchors.
- Rewrite each flagged anchor to name the target topic.
- Check that the same target is not described in wildly different ways, and that different targets do not share one anchor.
- Mark paid and user-submitted external links with
sponsoredorugc.
Exercise
A blog's "related posts" box links every article with the text "read more". Name two problems this causes and one fix.
Show answer
The anchors are generic, so they tell search engines nothing about each target, and the same phrase points to many different pages. Fix it by making the link text the article's title or a short topic phrase, for example "how to write URL slugs".
Exercise
Your site links to a partner with an affiliate URL. Which rel value should you add, and why not nofollow on your internal links too?
Show answer
Add rel="sponsored" to the affiliate link because it is a paid relationship. Internal links should stay plain, since nofollow on them does not usefully control ranking and only complicates how crawlers move through your site.