Sub topic 12
Plan internal links from the map
This chapter assumes you have a keyword map with one primary keyword per page, and that you know the site hierarchy from the previous chapter. You should be comfortable reading CSV files and short Python scripts.
Why the map drives links
An internal link is a link from one page of your site to another. Each link tells search engines which page covers a topic, and its anchor text (the clickable words) hints at what the target is about. The keyword map already records which page owns which keyword, so you can plan links from it instead of choosing them while writing.
Planning from the map prevents two common errors:
- Anchors that use a keyword to point at the wrong page, which sends mixed signals and can feed cannibalization.
- Pages with no links pointing to them, because nobody remembered they existed.
Three link rules
Start with three rules. Each can be applied mechanically to every row.
- Child to parent. Every page links up to its category, using the parent's primary keyword as anchor text.
- Parent to child. Every category links down to its children, using each child's primary keyword as anchor text.
- Sibling to sibling. Pages in the same cluster family link to each other where the reader would plausibly want the next step.
The anchor for a link is always the primary keyword of the target page, or a natural variation of it or of one of its supporting keywords. Never use the primary keyword of a different page.
Generate the link plan
Add a parent_url column to the map so the script knows the hierarchy. The script below uses an inline sample so it runs as shown. Swap in your own file with open("keyword_map.csv", newline="", encoding="utf-8").
import csv
import io
DATA = """url,primary_keyword,status,parent_url
/running-shoes/,running shoes,existing,
/blog/how-to-choose-running-shoes/,how to choose running shoes,existing,/running-shoes/
/running-shoes/trail/,trail running shoes,planned,/running-shoes/
"""
rows = list(csv.DictReader(io.StringIO(DATA)))
by_url = {row["url"]: row for row in rows}
for page in rows:
parent = by_url.get(page["parent_url"])
if parent is None:
continue
if page["status"] != "existing" or parent["status"] != "existing":
print(f"WAIT {parent['url']} -> {page['url']} (page is {page['status']})")
continue
print(f"LINK {page['url']} -> {parent['url']} anchor: {parent['primary_keyword']!r}")
print(f"LINK {parent['url']} -> {page['url']} anchor: {page['primary_keyword']!r}")
# LINK /blog/how-to-choose-running-shoes/ -> /running-shoes/ anchor: 'running shoes'
# LINK /running-shoes/ -> /blog/how-to-choose-running-shoes/ anchor: 'how to choose running shoes'
# WAIT /running-shoes/ -> /running-shoes/trail/ (page is planned)The WAIT lines matter. A link to a planned page would point at a missing URL. Keep those rows as a to-do list and add the links when the page goes live.
Check the result
After you publish, compare the plan with the real site. A crawler export of internal links gives you the actual links, and three checks are worth running:
- Orphans: existing pages in the map with no incoming links.
- Wrong anchors: links whose anchor text matches another page's primary keyword.
- Broken targets: links to URLs that are not in the map or are not live.
Fix wrong anchors first. They are the only check that can create a ranking conflict between two pages.
Exercise
Exercise
A blog article's row has the primary keyword "running shoe size guide". Another article's text mentions "size guide" and you want to link to the first article. The anchor you plan is "best running shoes". What is wrong, and what anchor should you use?
Show answer
"best running shoes" is a keyword that belongs to the category page, so using it as anchor text for the article tells search engines the article is about the category's topic. This can cause cannibalization. Use the article's own primary keyword, "running shoe size guide", or a close variation such as "our size guide for running shoes".