sfw/fix
Links are not crawlable medium

Links Are Not Crawlable (Lighthouse SEO)

Lighthouse flags navigation links with no real href, so crawlers can't follow them to find your other pages.

What you see

SEO
Links are not crawlable
Failing Elements
a (.menu-item)  javascript:void(0)
a  <missing href>

What’s actually happening

The Lighthouse SEO audit "Links are not crawlable" (audit id crawlable-anchors) fails and lists the offending anchors. Google follows links through the href attribute; if a link navigates via an onclick handler, a javascript:void(0) href, or no href at all, the crawler has nothing to follow and that destination may never get discovered or get any link equity. The pages often still work for humans because JavaScript wires up the click — which is exactly why this slips through manual testing.

Common causes

  • Anchors using href="javascript:void(0)" or href="#" with navigation done in an onclick handler
  • <a> tags with no href attribute at all, styled to look clickable
  • A SPA router intercepting clicks on bare anchors instead of rendering real, resolvable URLs
  • Buttons or <div>/<span> elements faking links via JS click handlers
  • Anchors whose href is set dynamically after load, so it's empty in the served HTML Lighthouse audits

How to fix it

  1. Put a real URL in every navigational link<a href="/products/widgets">Widgets</a> . The href must be a resolvable path or absolute URL — that's the single thing crawlers follow. Replace every javascript:void(0) and # with the actual destination.
  2. Use <button> for actions that aren't navigationIf a control opens a modal, toggles a panel, or submits a form, it's a button, not a link — <button type="button">. That stops Lighthouse from auditing it as a broken link and is correct for accessibility too.
  3. Make your SPA router emit real hrefsReact Router's <Link> and Next.js's <Link> render <a href="..."> under the hood — use them instead of onClick={() => navigate(...)} on a bare anchor. The client-side nav still works; crawlers now get a followable URL.
  4. Verify against the served HTMLView source and confirm the href is present in the raw markup, not just injected later in the DOM. Re-run Lighthouse (DevTools > Lighthouse, SEO category) and confirm crawlable-anchors passes.

Stop it recurring

Add an ESLint/CI rule that rejects href="#", href="javascript:void(0)", and href-less anchors so non-crawlable links never ship.

Related errors