slop audit
Blog post 78 / Technical SEO

Breadcrumb navigation: accessible HTML and SEO tests

Build breadcrumb navigation with accessible HTML, crawlable parent links, and optional BreadcrumbList markup. Test the trail before launch.

By Slop Audit · 6 min read

Breadcrumb navigation shows where a page sits in a website and gives visitors direct links to its parent pages. Build it with a named navigation landmark and real links, identify the current page, and test the trail on a deep URL. Add structured data separately if you want the hierarchy to be eligible for display in Google's desktop search results.

Choose the breadcrumb navigation trail

Imagine someone lands on a Rate limits article from a search result. The trail Docs → API → Rate limits tells them which section they are in and lets them open the API overview without using the main menu. It should be the same whether they arrive from search, follow an internal link, or paste the URL into a fresh tab.

Use the site's meaningful hierarchy rather than the visitor's history or a mechanical split of the pathname. A URL like /guides/api/rate-limits does not need a Guides crumb if /guides has no useful landing page. When an article appears in multiple categories, choose a stable primary trail for the page. If a small site has no meaningful intermediate pages, the main menu may already provide enough context.

Build accessible breadcrumbs in HTML

The W3C breadcrumb pattern calls for a named navigation landmark. Use an ordered list to express the sequence and native anchors for the parent pages. The final item here is plain text, so the trail has two tab stops. If you make the current item a link, add aria-current="page" to that link; the attribute is optional on a non-link current item.

<nav class="breadcrumbs" aria-label="Breadcrumb">
  <ol role="list">
    <li><a href="/docs">Docs</a></li>
    <li><span aria-hidden="true">/</span> <a href="/docs/api">API</a></li>
    <li><span aria-hidden="true">/</span> <span aria-current="page">Rate limits</span></li>
  </ol>
</nav>
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumbs li {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

The separators are decoration, so they are hidden from assistive technology. The explicit list role preserves list semantics when list markers are removed. Keep links visually recognizable, preserve the focus outline, and let long labels wrap instead of hiding a parent route on mobile. With a keyboard, Tab and Shift+Tab should move through the parent links and Enter should follow the focused link. A breadcrumb needs no arrow-key handler or custom tab order.

If the same page has a site menu, name it separately, such as Primary. The HTML landmarks guide explains how to distinguish multiple navigation regions on the same page.

Make parent links crawlable and useful

Google's crawlable link guidance recommends an anchor with an href that resolves to a real URL. A client router can still handle a normal click, but the rendered link should have a usable destination. A button with an on-click redirect or an anchor with href="#" does not provide that contract.

Open the leaf directly on the deployed site. Check that each parent points to its preferred public URL, then open each destination and confirm it returns the expected content. A 200 for the homepage or an error template does not make a link to API documentation correct. Repeat after a client-side route change if the same component is reused across pages; stale breadcrumb state may only appear after navigation. Use the broken internal link checklist when the wrong destination appears across several templates.

Add optional BreadcrumbList structured data

The HTML trail is for people and provides ordinary links. BreadcrumbList describes the hierarchy to search engines. If you generate both, use the same source for labels and order so a category rename does not leave the JSON-LD behind. Use absolute preferred URLs in the markup.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Docs",
      "item": "https://example.com/docs"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "API",
      "item": "https://example.com/docs/api"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "Rate limits",
      "item": "https://example.com/docs/api/rate-limits"
    }
  ]
}
</script>

Google's BreadcrumbList documentation requires at least two list items for this feature and allows the final item's URL to be omitted. Run the deployed URL through the Rich Results Test. Valid markup makes the page eligible for the desktop breadcrumb treatment; it does not guarantee that Google will show it. For syntax and deployment troubleshooting, see the JSON-LD validation guide.

Test breadcrumb navigation on a deployed deep link

Use one representative leaf per template. Check the trail's order and exact destinations, then follow a parent link with the keyboard and check the page you reached. This Playwright example assumes a baseURL and an API overview headed “API reference.”

import { test, expect } from '@playwright/test';

test('API article exposes its parent trail', async ({ page }) => {
  await page.goto('/docs/api/rate-limits');

  const trail = page.getByRole('navigation', { name: 'Breadcrumb' });
  const crumbs = trail.getByRole('listitem');
  await expect(crumbs).toHaveCount(3);
  const docs = crumbs.nth(0).getByRole('link', { name: 'Docs', exact: true });
  const api = crumbs.nth(1).getByRole('link', { name: 'API', exact: true });
  await expect(docs).toHaveAttribute('href', '/docs');
  await expect(api).toHaveAttribute('href', '/docs/api');
  await expect(trail.locator('[aria-current="page"]')).toHaveCount(1);
  await expect(crumbs.nth(2).locator('[aria-current="page"]')).toHaveText('Rate limits');

  await docs.focus();
  await page.keyboard.press('Tab');
  await expect(api).toBeFocused();
  await page.keyboard.press('Enter');
  await expect(page).toHaveURL(/\/docs\/api$/);
  await expect(page.getByRole('heading', { level: 1, name: 'API reference' }))
    .toBeVisible();
});

This test isolates the trail; starting at the first crumb intentionally skips the earlier tab stops. During manual review, Tab from the top of the page, check focus at a narrow viewport, and verify that a screen reader can find the named landmark without reading the decorative slashes. For the surrounding menus and critical routes, use the website navigation testing checklist.

Audit the public page after the fix

Run Slop Audit on the public leaf URL to review its sampled internal link checks, JSON-LD parsing, and any available browser landmark, keyboard, and axe evidence. Fix the issues you can reproduce and rescan the same URL to compare the reports. Use the focused test above to verify the intended hierarchy and every crumb in the trail, and use Google's tool for rich result eligibility.