invalid-links
What it does
This skill checks a page's links for empty, JavaScript-only or non-URL destinations that crawlers cannot follow. It is for developers who build navigation and dynamic links.
When to use it
- ✓When a button styled as a link uses javascript:void as its destination.
- ✓When dynamic menu items have no real URL.
- ✓When an audit reports links with empty or hash-only destinations.
Skill link
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/invalid-links/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can you check my page for links that search engines cannot follow?”
5 new skills a week. 1 minute to read.
How it works
The agent reads every link element and flags empty, hash-only, JavaScript-based or missing hrefs. It suggests replacing them with real URLs and using JavaScript only to enhance navigation.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Fix invalid links
Google can only follow links declared as valid <a href> 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
<a>tags (empty href, JavaScript voids, non-URL values) are not crawlable — Googlebot cannot follow them - Links must use crawlable
<a href='...'>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 <a> 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 (<a> without any href attribute). Report the count per type.
Fix
- For links using
href='javascript:void(0)'orhref='#'as navigation triggers:- Add a real URL as the href value
- Use JavaScript to enhance the navigation, not replace it
- Before:
<a href="javascript:void(0)" onclick="openModal()">View Details</a> - After:
<a href="/products/details" onclick="openModal(event)">View Details</a>
- For
<a>elements without href (used as button-like elements):- If they trigger navigation: add href
- If they trigger actions only: change to
<button>elements
- For empty
href='': either add the correct URL or remove the<a>wrapper - For
href='#'anchors: use meaningful fragment IDs that reference actual page sections (href='#features'whereid='features'exists)
Explain
Google's documentation states that crawlable links must be <a> tags with an href attribute containing a valid URL. Links with javascript: hrefs, empty hrefs, or no href attribute are not followed by crawlers. This means pages only reachable through invalid links are not discovered by Googlebot, and any intended PageRank flow is blocked.
Code Review
Query all <a> elements in the rendered DOM. For each, extract the href attribute. Flag: absent href, empty string, '#' only, values starting with javascript:, values starting with void. Separately flag <div>, <span>, or <button> elements with onclick navigation handlers that lack a corresponding <a href> — these are not crawlable.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/seo/invalid-links
FAQ
Why does a broken href matter for SEO?
The skill says crawlers cannot follow invalid links, so the destination pages may never be discovered.
Can JavaScript-only navigation work?
The skill says onclick navigation without an href is invisible to search engine crawlers.
Are mailto and tel links a problem?
The skill says they are valid, though they do not help with page discovery.
Details
Original description by the author
Use when auditing a page's link elements for crawlability, reviewing JavaScript-heavy SPAs where navigation may not use `<a href>` tags, or checking that dynamically generated links have valid href values.
Popularity
- GitHub stars
- 75k
- Ranking position
- #2899
- License
- MIT
- Updated
- 10/31/2026
Comments
- …
More skills from this repository
frontendchecklist
75kChecks frontend code and live pages against 380+ rules for accessibility, speed, SEO and security, using a command-line tool.
frontend-checklist-global
75kAudits a frontend project against all 386 Front-End Checklist rules, and gives a specific fix for each issue found.
404-page
75kChecks that your missing-page screen offers helpful links and returns a real 404 status, to help lost visitors find their way.
about-page
75kReviews whether your site has a clear About page that explains who runs it, to build trust with visitors and search engines.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.