Crawlable links are links that a crawler can follow reliably. For Google these are <a> elements with an href attribute that holds a resolvable URL. Google states that it can only crawl a link if it is such an element.
What does it mean for SEO?
Google finds new URLs mainly through links. A menu that changes pages with a click handler but has no <a href> in the HTML shows the crawler no path to the target pages.
JavaScript itself is fine. Google’s JavaScript documentation says it is fine to inject links into the DOM, as long as they follow the best practices for crawlable links. An onclick on an <a href="/shoes"> is not a problem, because the href holds a real destination. For single-page apps, Google advises using the History API rather than URL fragments such as #/products. For image links, Google uses the alt text as anchor text.
Example
<!-- crawlable -->
<a href="/products/shoes">Shoes</a>
<a href="/products/shoes" onclick="track()">Shoes</a>
<!-- not reliably crawlable -->
<span href="/products/shoes">Shoes</span>
<a onclick="goTo('/products/shoes')">Shoes</a>
<a href="javascript:goTo('shoes')">Shoes</a>
The examples follow Google’s link documentation.
Common mistakes
- Buttons or
divelements that navigate only through click handlers. href="#"orjavascript:placeholders for real pages.- Hash-based routing instead of the History API.
Sources
- SEO link best practices – Google Search Centraldevelopers.google.com
- JavaScript SEO basics – Google Search Centraldevelopers.google.com
Last updated: