Langsung ke konten
Skillpedia
Website & UI (frontend)75k Β· #2899

invalid-links

Fungsinya

Skill ini memeriksa tautan di halaman untuk tujuan yang kosong, hanya JavaScript, atau bukan URL yang tidak dapat diikuti perayap. Skill ini cocok untuk developer yang membangun navigasi dan tautan dinamis.

Kapan dipakai

  • βœ“Saat tombol yang diberi gaya seperti tautan memakai javascript:void sebagai tujuannya.
  • βœ“Saat item menu dinamis tidak memiliki URL sungguhan.
  • βœ“Saat audit melaporkan tautan dengan tujuan kosong atau hanya hash.

Link skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/invalid-links/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/invalid-links/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda memeriksa halaman saya untuk tautan yang tidak dapat diikuti mesin pencari?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent membaca setiap elemen tautan dan menandai href yang kosong, hanya hash, berbasis JavaScript, atau tidak ada. Agent menyarankan penggantian dengan URL sungguhan dan penggunaan JavaScript hanya untuk menyempurnakan navigasi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

  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: <a href="javascript:void(0)" onclick="openModal()">View Details</a>
    • After: <a href="/products/details" onclick="openModal(event)">View Details</a>
  2. 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
  3. For empty href='': either add the correct URL or remove the <a> wrapper
  4. For href='#' anchors: use meaningful fragment IDs that reference actual page sections (href='#features' where id='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

Pertanyaan umum

Mengapa href yang rusak penting untuk SEO?

Skill menyatakan perayap tidak dapat mengikuti tautan yang tidak valid, sehingga halaman tujuan mungkin tidak pernah ditemukan.

Bisakah navigasi yang hanya memakai JavaScript berfungsi?

Skill menyatakan navigasi onclick tanpa href tidak terlihat oleh perayap mesin pencari.

Apakah tautan mailto dan tel bermasalah?

Skill menyatakan tautan tersebut valid, meskipun tidak membantu penemuan halaman.

Detail

Deskripsi asli dari pembuat

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.

repo: thedaviddias/Front-End-Checklist

Popularitas

Bintang GitHub
75k
Peringkat
#2899
Lisensi
MIT
Diperbarui
31/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa