Skillpedia
المواقع والواجهات (frontend)75k · #2899

invalid-links

ما الذي تفعله

تتحقق هذه المهارة من روابط الصفحة بحثًا عن وجهات فارغة أو تعتمد على JavaScript فقط أو ليست عناوين URL، فلا تستطيع الزواحف تتبعها. وهي موجهة للمطورين الذين يبنون التنقل والروابط الديناميكية.

متى تستخدمها

  • ✓عندما يستخدم زر يبدو كرابط javascript:void كوجهة.
  • ✓عندما لا تملك عناصر القائمة الديناميكية عنوان URL حقيقيًا.
  • ✓عندما يُبلغ التدقيق عن روابط وجهتها فارغة أو تشير إلى # فقط.

رابط المهارة

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

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/invalid-links/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“هل يمكنك فحص صفحتي بحثًا عن روابط لا تستطيع محركات البحث تتبعها؟”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يقرأ الوكيل كل عنصر رابط ويُعلّم الوجهات الفارغة أو التي تشير إلى # فقط أو القائمة على JavaScript أو الناقصة. ويقترح استبدالها بعناوين 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

  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

الأسئلة الشائعة

لماذا تؤثر href المعطوبة في SEO؟

تقول المهارة إن الزواحف لا تتبع الروابط غير الصالحة، فقد لا تُكتشف الصفحات الوجهة أبدًا.

هل يمكن أن يعمل التنقل بـ JavaScript فقط؟

تقول المهارة إن التنقل عبر onclick دون href غير مرئي لزواحف محركات البحث.

هل روابط 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.

repo: thedaviddias/Front-End-Checklist

الشعبية

نجوم GitHub
75k
الترتيب
#2899
الترخيص
MIT
آخر تحديث
31‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة