--- name: invalid-links description: "Use when auditing a page's link elements for crawlability, reviewing JavaScript-heavy SPAs where navigation may not use `` tags, or checking that dynamically generated links have valid href values." metadata: category: seo priority: medium difficulty: intermediate estimatedTime: "10" source: frontendchecklist.io url: https://frontendchecklist.io/en/rules/seo/invalid-links --- # Fix invalid links Google can only follow links declared as valid `` elements with crawlable URL values. Invalid links — empty hrefs, JavaScript voids, or non-URL content — prevent PageRank from flowing to linked pages and stop Googlebot from discovering those destinations. ## Quick Reference - Invalid `` tags (empty href, JavaScript voids, non-URL values) are not crawlable — Googlebot cannot follow them - Links must use crawlable `` elements with valid absolute or relative URLs to pass PageRank and be followed - JavaScript-only navigation (onClick handlers without `href`) is invisible to search engine crawlers ## Check Parse all `` elements on the page. Flag links where `href`: (1) is empty (`href=''` or `href='#'` with no meaningful target). (2) starts with `javascript:` (e.g., `href='javascript:void(0)'`). (3) starts with `mailto:` or `tel:` — these are valid but not crawlable for page discovery. (4) contains only a fragment identifier that references an anchor not present on the page. (5) is absent entirely (`` without any href attribute). Report the count per type. ## Fix 1. For links using `href='javascript:void(0)'` or `href='#'` as navigation triggers: - Add a real URL as the href value - Use JavaScript to enhance the navigation, not replace it - Before: `View Details` - After: `View Details` 2. For `` elements without href (used as button-like elements): - If they trigger navigation: add href - If they trigger actions only: change to `