SEO
Crawlable Links: What Google Can and Can't Follow
Key takeaways
- Use a real <a href> element for any link you want Google to discover.
- JavaScript can inject links, as long as the result is a standard <a href>.
- Span, onclick-only and fragment-based links are not reliably crawled, per Google.
- Single-page apps should use real paths with the History API instead of hash fragments.
- Anchor text should be descriptive and concise, not generic or stuffed with keywords.
Which links can Google actually crawl?
According to Google Search Central's link best practices, Google can generally crawl a link only if it is an <a> HTML element with an href attribute. Other formats, such as <span> elements or onclick handlers with no href, are not parsed reliably. If you want a page discovered by following links, use a standard anchor that points to a real URL.
What link formats does Google list as fine, and which as risky?
Google's link best practices page (last updated 2025-12-10) says it cannot reliably extract URLs from anchors without an href, or from other tags that act like links only because of script events. It lists absolute, root-relative and relative hrefs as workable forms. It also says extra attributes such as a class, or an onclick on an anchor that still has a real href, are fine.
The same page lists several patterns as not recommended: framework-style attributes such as routerLink on an anchor, a span with an href, an anchor that relies on an onclick with no href, and javascript: URLs. Google notes it may still attempt to parse some of these, so they are not guaranteed to fail, but the documentation does not treat them as dependable.
Can JavaScript-generated links be crawled?
Yes, with a condition. Google's JavaScript SEO basics page (last updated 2026-03-04) says Google finds URLs by parsing the href attribute of HTML links, in both the raw and rendered HTML. It adds that it is fine to inject links into the DOM with JavaScript if they follow the link best practices. In other words, the technique is not the problem; the final markup is. If a script produces a real <a href>, Google's documentation treats it like any other link.
What should single-page apps do about routing?
The JavaScript SEO basics page describes fragment-based routing, where links look like #/products and a script swaps content, as a bad practice, and it advises against using fragments to load different page content. Its recommendation is to use the History API instead: render links with real paths such as /products, then have a click handler intercept the click and update the view. The example on that page is a pattern to adapt rather than paste, so test any version you build, for instance with the URL Inspection tool, which Google's link page suggests for checking that JavaScript-inserted anchor text appears in the rendered HTML.
How should you write anchor text?
Google's SEO Starter Guide describes link text, also called anchor text, as the visible part of a link that tells users and Google something about the destination. The link best practices page says good anchor text is descriptive, reasonably concise and relevant to both the current and linked page. It calls generic text such as "click here" or "read more" too generic, empty link text bad, and warns against keyword stuffing. For image links, it says Google uses the image's alt text as the anchor text.
A practical checklist
- Make navigation, menus and calls to action real anchors with real hrefs, not buttons or spans that only respond to clicks.
- Make sure every page you care about is linked from at least one other page on your site; Google's link page says so directly, and the starter guide notes that Google primarily finds pages through links from pages it already crawled.
- Check rendered HTML, not just your source, if links are generated by JavaScript.
- Replace vague anchors with short, specific descriptions.
One limit worth stating: Google's documents describe how its crawler discovers links, not how links affect rankings. Crawlable markup gets pages found; this guidance does not promise any ranking outcome, and other search engines or AI crawlers may handle script-driven links differently than Google does.
Frequently asked questions
Does Google follow links that use JavaScript onclick?
Google says it can't reliably extract URLs from elements that act as links only through script events. An onclick on an anchor that also has a real href is listed as fine.
Can I add links to a page with JavaScript?
Yes. Google's JavaScript SEO page says injecting links into the DOM is fine as long as they follow link best practices, meaning standard a elements with a resolvable href.
Are hash URLs like #/products good for SEO?
Google's documentation calls fragment-based routing a bad practice for loading different content. It recommends real paths with the History API instead.
What is wrong with 'click here' as anchor text?
Google's link guidance calls generic text like 'click here' or 'read more' too generic. Descriptive, concise text that matches the destination page is preferred.
Sources
- Link best practices for Google — Google Search Central
- JavaScript SEO basics — Google Search Central
- SEO Starter Guide — Google Search Central
Keep reading
See how AIrecommend.ai helps businesses get found and recommended by AI assistants.