invalid-links
できること
このスキルは、ページのリンクに、クローラーがたどれない空の行き先、JavaScript だけの行き先、URL でない行き先がないかを確認します。ナビゲーションや動的なリンクを作る開発者向けです。
使う場面
- ✓ボタンがリンクのように見え、行き先が javascript:void になっているとき。
- ✓動的なメニュー項目に、本当の URL がないとき。
- ✓監査で、空またはハッシュだけの行き先のリンクが報告されたとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/invalid-links/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“検索エンジンがたどれないリンクが、ページにないか確認してもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、すべてのリンク要素を読み、空、ハッシュだけ、JavaScript による、または欠けている href を指摘します。それらを本当の URL に置き換え、JavaScript はナビゲーションを強化するためにだけ使うことを提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
よくある質問
壊れた href はなぜ SEO に問題なのですか?
クローラーは無効なリンクをたどれないため、行き先のページが発見されないことがあるからだとこのスキルは説明しています。
JavaScript だけのナビゲーションは機能しますか?
href のない onclick のナビゲーションは、検索エンジンのクローラーには見えないとこのスキルは説明しています。
mailto や tel のリンクは問題ですか?
有効なリンクだが、ページの発見には役立たないとこのスキルは説明しています。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 75k
- ランキング
- #2899
- ライセンス
- MIT
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
frontendchecklist
75kコマンドラインツールを使って、フロントエンドのコードとライブページを、アクセシビリティ、速度、SEO、セキュリティに関する380以上のルールと照らし合わせて確認します。
frontend-checklist-global
75kフロントエンドのプロジェクトを、386のFront-End Checklistのルールすべてと照らし合わせて監査し、見つかった問題ごとに具体的な修正方法を示します。
404-page
75k見つからないページの画面に役立つリンクがあり、本物の404ステータスを返すかを確認し、迷った訪問者が目的のページを見つけられるようにします。
about-page
75kサイトの運営者が誰かを説明する、分かりやすいAboutページがあるかを確認し、訪問者と検索エンジンからの信頼を高めます。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。