Sub topic 10
Checking that a mention is really unlinked
This chapter assumes you can read HTML anchor tags, know what rel="nofollow" means, and have a list of candidate pages from the discovery step. Search results only suggest that a page mentions your brand. Before you write to anyone, confirm that the page names you and has no link to you.
Why verification matters
Skipping this step produces embarrassing emails, such as asking for a link the page already has. Search operators and alert tools match text, and they often miss existing links. Search results can also be stale, because the page may have been edited since it was indexed.
What to check on each page
- Fetch the live page. Do not rely on the search snippet or a cached copy.
- Look for any anchor pointing to your domain. Check the root domain and its subdomains, such as
wwwandblog. - Confirm the brand appears in the visible text. The match should be a whole-word match, so "Acme" does not match "Acmeville".
- Read the context. The mention should be about your company, not another business or a common word.
Automating the check
The function below returns True only when the text names the brand and no anchor points to your domain. It requires beautifulsoup4.
import re
from urllib.parse import urlparse
from bs4 import BeautifulSoup
def is_unlinked_mention(html, brand, domain):
soup = BeautifulSoup(html, "html.parser")
domain = domain.lower()
for a in soup.find_all("a", href=True):
host = urlparse(a["href"]).netloc.lower()
if host == domain or host.endswith("." + domain):
return False
text = soup.get_text(" ")
pattern = r"\b" + re.escape(brand) + r"\b"
return re.search(pattern, text, re.IGNORECASE) is not None
html = "<p>We tested Acme Analytics last month.</p>"
print(is_unlinked_mention(html, "Acme Analytics", "acme-analytics.com"))It prints True. The function compares the host name exactly, so a link to acme-analytics.com.evil.example does not count as a link to you.
Common errors
- Treating nofollow as unlinked. A link with
rel="nofollow"is still a link. Do not ask for a second one. You can note it as low value. - Missing a link to a different page. A link to your homepage or a product page still means the site links to you. Decide whether you want a better target, and word the request as a change, not a new link.
- Content loaded by JavaScript. A plain HTTP fetch will not see anchors added by scripts. If a page looks suspicious, open it in a browser or use a rendering tool.
- Ambiguous brand names. A brand such as "Apex" matches many businesses. Add a context check, such as a nearby product term, or review the page by hand.
- Mentions in images or alt text. The brand may appear only in an image. These are valid prospects, but your text matcher will not find them.
Exercise
A page contains the text "Acme Analytics" and a link to https://blog.acme-analytics.com/report with rel="nofollow". Is it an unlinked mention? What does the function above return?
Show answer
It is not an unlinked mention, because the page already links to your domain, and the link is on a subdomain. The function returns False, since the host ends with ".acme-analytics.com". The nofollow attribute does not change this, though it lowers the link's value.