Back to HTML

Internal Links and Site Navigation in HTML

Coding Tutorials Team 18 July 2026

Internal links do more than let people move around. They tell search engines how your pages relate to each other and which are most important, and they determine whether someone who arrives on one article ever finds a second. The markup is straightforward, and a few conventions prevent most of the maintenance problems.

Use root relative paths for navigation

A link beginning with a slash resolves from the site root regardless of which page it appears on.

<a href="/html/basics/">HTML Basics</a>

This is what makes a shared header work. The same markup can be included on the home page and on a page three folders deep, and the link resolves correctly from both. A document relative path would need to differ on each, which is unmanageable in an include.

Avoid full addresses with your own domain in internal links. They break the moment you work on a local copy or a staging server, and moving between environments turns into a find and replace exercise across the codebase.

The nav element

Wrap major navigation blocks in a nav element. It is a landmark, which means screen reader users can jump directly to it or skip past it, and it identifies the block as navigation rather than as an arbitrary list of links.

<nav aria-label="Main"> <ul> <li><a href="/html/">HTML</a></li> <li><a href="/css/">CSS</a></li> </ul> </nav>

Not every group of links needs one. Nav is for major blocks such as a main menu, a footer menu or a breadcrumb trail. Links scattered through an article are just links, and wrapping every set of them in a nav dilutes the landmark until it stops being useful.

Where a page has more than one nav, give each an accessible label so they can be told apart. Without labels a user hears the same announcement several times with no way to know which is the main menu.

Marking the current page

The link to the page a user is already on should be identified. The correct mechanism is an aria attribute rather than a class alone.

<a href="/html/" aria-current="page">HTML</a>

A class styles it visually and communicates nothing to a screen reader. The aria attribute is announced, so someone who cannot see the highlight still knows where they are. You can style from the attribute directly, which keeps the two in sync automatically and removes the risk of one being updated without the other.

Some sites remove the link entirely on the current page. That is defensible, though it makes the navigation shift between pages, which is disorienting. Keeping the link and marking it is generally the better option.

Breadcrumbs

A breadcrumb trail shows where a page sits in the hierarchy and gives an easy route back up. It is an ordered list, because sequence is part of the meaning, inside a nav with its own label.

Search engines will often display a breadcrumb path in place of the raw address in a result, which makes the listing more readable. Adding structured data describing the trail improves the chance of that happening, though the markup alone is frequently enough.

Write link text that stands alone

Screen reader users often pull up a list of every link on a page. In that list, each link appears with no surrounding sentence. A page containing nine links all reading click here produces a list of nine identical entries.

Write the destination into the link text instead. The words inside the anchor should describe where it goes clearly enough to make sense in isolation, which also happens to be what search engines use to understand the target page. The same change improves both.

Orphan pages and link depth

A page with no internal links pointing at it is an orphan. Visitors cannot reach it by browsing and crawlers may never discover it at all, since a sitemap alone is a weak signal compared with an actual link. Every page you publish should be reachable from at least one other, and ideally from somewhere obvious.

The related measure is depth, meaning how many clicks from the home page a piece of content sits. Anything buried five or six levels down is treated as less important and is genuinely harder for people to find. Category and subcategory index pages exist largely to keep that number small on a site with a lot of articles.

Link deliberately, not exhaustively

Linking every occurrence of a term makes an article tiring to read and dilutes the signal, since a page linked from every mention is not obviously more important than one linked once. Link the first meaningful mention, link where a reader genuinely might want more depth, and leave the rest as plain text.

The pages you link to most from within your own site are the ones you are telling search engines matter most. That is worth being deliberate about rather than leaving to whatever your template happens to output.