Sub topic 8
What internal links do
This chapter assumes you can read basic HTML, including the a element and its href attribute. It also assumes you know how a browser requests a page over HTTP, and that you have a general idea of why pages need to be found in search. The previous chapters covered how crawlers follow links and how slugs are written. This chapter covers what a link between two pages on your own site is for.
What an internal link is
An internal link is a link from one page to another page on the same site. A link to a different domain is an external link. For most sites, internal links are the part of link building you fully control, because you can edit both ends.
<p>
Before renaming a page, read the
<a href="/guides/url-slugs/">guide to writing URL slugs</a>.
</p>This link sits inside a sentence. A link in the main navigation, the footer, or a sidebar is also internal. Both kinds count, but they send different signals, which the sections below explain.
The four jobs of an internal link
Internal links do four things for search engines and readers.
- Discovery. A crawler finds new URLs by following links from pages it already knows. A page with no links pointing to it may never be found unless it appears in a sitemap.
- Context. The link text, and the text around the link, tells the search engine what the target page is about. The next chapters cover how to write that text.
- Importance. The more internal links point to a page, and the closer those links sit to your strongest pages, the more the site signals that the page matters.
- Navigation. Readers use links to move to related content. A search engine wants pages that help people, so a site that is easy to move through is easier to rank.
Discovery
A crawler keeps a queue of URLs. It fetches a page, extracts the links, and adds unseen URLs to the queue. Your site is therefore only as discoverable as its link graph. If page B is linked only from page A, and A is never crawled, B stays hidden.
A page that has no internal links pointing to it is an orphan page. Orphans are the most common discovery failure on sites that publish often. A new post goes live, but nobody adds a link to it from an index or a related article.
The old draft links out to the home page, but nothing links to it. A crawler that starts at the home page never reaches it.
Context
A search engine cannot read a page the way you do. It relies on signals, and the words of a link are one of them. A link labeled "guide to writing URL slugs" says something specific about the target. A link labeled "click here" says nothing. Anchor text gets its own chapters later, so for now remember one point: every internal link is a small description of the page it points to, and you write that description yourself.
Importance
Search engines have long used links as a vote of confidence. Google's original PageRank idea treated a page as important if important pages linked to it. Modern ranking uses many more signals, and Google does not publish how it weighs internal links. Still, two practical rules hold up:
- Pages that many other pages link to are crawled more often and are treated as more central to the site.
- A page linked from your home page is generally treated as more important than one buried several clicks away.
The second rule leads to click depth and site structure, which the architecture chapter covers.
Navigation
Links also serve readers. A reader who finishes an article about slugs may want the article about redirects. If the link is there, the reader stays on your site. If it is missing, the reader goes back to search results. Engagement is hard to attribute to rankings, but a site that frustrates readers usually has structural problems too.
Navigation links versus contextual links
Not all internal links carry the same information.
| Type | Where it appears | Strength | Typical risk |
|---|---|---|---|
| Navigation | Header, menu, breadcrumbs | Gives broad structure. The same link repeats on every page. | Only a few top pages get links. Deep pages are missed. |
| Footer or sidebar | Repeated block on many pages | Helps discovery, with little context. | Long lists of links dilute the signal. |
| Contextual | Inside body text | Carries topic context from the surrounding sentence. | Needs manual effort, so it is skipped. |
| Hub or index | A page that lists related pages | Groups related pages and supports shallow depth. | Goes stale when new pages are not added. |
Navigation gets crawlers around, and contextual links explain why two pages are related. A healthy site uses both. If every internal link on your site is in the template, you have navigation but little context.
Seeing the link graph in code
You can reason about internal links as a directed graph. Each page is a node, and each link is an arrow from the page that contains it to the page it points to. The script below takes a small map of pages and their outbound links, counts inbound links for each page, and reports the orphans.
pages = {
"/": ["/guides/", "/about/"],
"/guides/": ["/guides/url-slugs/", "/guides/anchor-text/"],
"/guides/url-slugs/": ["/guides/anchor-text/"],
"/guides/anchor-text/": [],
"/about/": [],
"/old-draft/": ["/"],
}
inbound = {url: 0 for url in pages}
for source, targets in pages.items():
for target in set(targets):
# Count each source page once, and ignore links to itself
if target in inbound and target != source:
inbound[target] += 1
for url, count in sorted(inbound.items()):
print(f"{count} inbound {url}")
orphans = sorted(url for url, count in inbound.items() if count == 0)
print("Orphans:", orphans)The output is:
1 inbound /
1 inbound /about/
2 inbound /guides/anchor-text/
1 inbound /guides/
1 inbound /guides/url-slugs/
0 inbound /old-draft/
Orphans: ['/old-draft/']Two details matter. The script counts each linking page once, because ten links from one page add less than one link from ten pages. It also ignores self-links, which add nothing to discovery. A real audit tool does the same thing against a crawl of your live site.
Common errors
Orphan pages
A page exists and is published but nothing links to it. This often happens after a redesign that drops an old menu, after a migration, or when authors publish without adding links from related pages. The fix is to add at least one contextual link from a relevant page, and one from a hub if the page belongs in a group.
Links that only exist after interaction
If a link appears only after a click, a hover, or a script finishes running, a crawler may never see it. Search engines can render JavaScript, but rendering is slower and less reliable than reading plain HTML. Put important links in the initial HTML as normal a elements. The next chapter covers this.
Links to redirected or removed URLs
A link that points to an old slug still works if a 301 redirect exists, but it adds a hop. Many such hops make crawling slower and can build redirect chains. A link to a deleted page ends in a 404. When you change a slug, update the internal links too, instead of relying on the redirect.
Links to non-canonical URLs
If your site can be reached at several addresses, for example with tracking parameters, link to the one you prefer. Mixed links make the search engine's job harder and can split signals across duplicates.
Too many links
There is no fixed limit, and the old advice of 100 links per page is not a rule now. The real problem is dilution. A page with hundreds of links in the template makes each link less meaningful, and a reader cannot tell which ones matter. Link where it helps the reader, and prefer relevant links over exhaustive ones.
Linking only downward
Sites often link from hubs to detail pages but not back, and never across between related detail pages. Cross-links between related pages are what give the graph its context.
A short checklist
Before moving on, you should be able to check each page against these questions:
- Does at least one other page link to it with a normal
aelement? - Does a link to it appear in body text on a related page, not only in menus?
- Does the page link out to related pages on the site?
- Do the links point to the final, canonical URL and not a redirect?
Exercises
Exercise
A new article is published and added to the XML sitemap, but no other page on the site links to it. Name the problem and give two ways to fix it.
Show answer
The article is an orphan page. A sitemap lets search engines find the URL, but it gives no context and no sign of importance. Fix it by adding a contextual link from a relevant existing page, and by adding it to the relevant hub or index page. Link from the new article to related pages as well.
Exercise
In the Python example, why does the script use set(targets) before counting?
Show answer
It counts each linking page only once per target, even if that page links to the target several times. Inbound links from many different pages matter more than repeated links from one page, so duplicates would inflate the count.