Check 08.06 · JavaScript and HTML rendering

Make links available in HTML with href

Make every internal link appear in the HTML as an a tag with a resolvable href, whatever your CMS, your framework and your router.

Priority
Critical
Difficulty
Intermediate
Estimated time
1 h to 2 days
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A crawler discovers a site's pages by following links, and it reliably recognizes only one form of link: an <a> tag with an href attribute containing a real address. This check consists of verifying that navigation, breadcrumbs, pagination, product lists and contextual links are <a href> elements, present in the initial HTML and not built later by JavaScript. Expected result: the number of internal links is roughly the same in the initial HTML and in the rendered DOM, and every link points to a URL that responds.

Why it matters

Google sums it up this way: as a general rule, it can only crawl a link if it is an <a> element with an href attribute. It cannot reliably extract the URL from an <a> without an href, and the URL must resolve to an actual web address. A link inserted by JavaScript remains crawlable if it follows this markup, but it is only discovered after rendering.

This delay has three consequences:

  • Google discovers the pages later, and does not discover them at all if rendering fails.
  • Generative engine crawlers, which read the initial HTML without running JavaScript according to published observations, only see the links present in the server response. A menu built in JavaScript hides the rest of the site from them.
  • Internal linking only passes signals through links the search engine has seen.

Fragment URLs raise a related problem: Google asks you not to use fragments (#/produits) to load different content, and to use the History API instead. To a crawler, example.com/#/chaises and example.com/#/tables are the same page.

What it improves

  • Page discovery All linked pages are found at crawl time, without depending on rendering.
  • Internal linking Link equity flows to strategic pages.
  • Visibility in generative engines Their crawlers can move from one page to another and find deep pages. Indirect effect, with no guarantee of being cited.
  • Accessibility and usability A real link opens in a new tab, can be copied and shared, and works with the keyboard.
  • Rankings Indirect effect, through better discovery and internal linking that is taken into account.

How to check

1. Compare the number of links. In the initial HTML:

curl -s -L https://example.com/ | grep -o -i '<a [^>]*href="[^"#][^"]*"' | wc -l

Then in the browser console, on the displayed page:

document.querySelectorAll('a[href]:not([href^="#"]):not([href^="javascript:"])').length

A gap of a few links (login button, widget) is normal. A gap of dozens of links means that the menu, the lists or the pagination are built by JavaScript.

2. List the fake links in the rendered DOM:

console.table([...document.querySelectorAll('a:not([href]), a[href^="javascript:"], a[href="#"], [routerlink]:not(a), [onclick]:not(a):not(button)')]
  .map((el) => ({ balise: el.tagName, texte: el.textContent.trim().slice(0, 60) })));

3. Run Lighthouse, SEO category: the “Links are crawlable” audit (crawlable-anchors) lists the links whose href is not crawlable.

4. Across the whole site, compare in Screaming Frog the number of outlinks per page between a crawl in “Text Only” mode and a crawl in JavaScript mode.

How to implement

Before you start

What is crawlable, according to Google's documentation:

Markup Crawlable
<a href="https://example.com/chaises"> yes
<a href="/chaises"> or <a href="./chaises"> yes
<a href="/chaises" onclick="suivre('chaises')"> yes, the href is enough
<a routerLink="chaises"> with no rendered href not reliable
<span href="/chaises"> not reliable
<a onclick="aller('/chaises')"> not reliable
<a href="javascript:aller('chaises')"> not reliable
<a href="#/chaises"> (fragment routing) no, same page for the crawler

Rules to apply everywhere:

  • every indexable page receives at least one <a href> link from another page;
  • the href URL is the canonical version, with no redirect;
  • the link text describes the destination (see Use descriptive and varied anchor text (opens in a new tab));
  • navigation links are in the initial HTML, not only after rendering.

Fake onclick links are fixed with the guide Avoid links that rely solely on JS events (opens in a new tab). The general principles are in Use crawlable HTML links (opens in a new tab).

Apache

Versions Apache 2.4.

A single-page application that moves from fragment routing to History API routing needs the server to return the application for any URL that does not match a file. In the .htaccess file or the virtual host:

FallbackResource /index.html

This rule returns 200 for every URL, including those that do not exist: deal with this using Check SPA HTTP status codes (opens in a new tab), or better, move to server-side rendering.

Nginx

Versions Nginx 1.18 and later, including the 1.30 stable branch.

Same need, in the server block:

location / {
    try_files $uri $uri/ /index.html;
}
sudo nginx -t && sudo systemctl reload nginx

WordPress

Versions WordPress 6.4 and later (classic themes and block themes).

Menus (Appearance > Menus or the Site Editor, Navigation block), post lists, the breadcrumbs of SEO plugins and pagination produce <a href> links rendered in PHP. Problems come from:

  • plugin mega menus that load their submenus through AJAX on hover: choose an option that renders them fully in the HTML;
  • product or post grids filtered through AJAX that remove pagination: keep the links generated by the_posts_pagination() or WooCommerce pagination;
  • page builder buttons configured with a JavaScript action instead of a link: fill in the button's link field.

Shopify

Versions Online Store 2.0 themes, Shopify admin, November 2026.

Liquid templates produce real links: use the URL objects rather than hand-written addresses.

<nav aria-label="Breadcrumb">
  <a href="{{ routes.root_url }}">Home</a>
  {% if collection %}
    <a href="{{ collection.url }}">{{ collection.title }}</a>
  {% endif %}
</nav>

{% for product in collection.products %}
  <a href="{{ product.url }}">{{ product.title }}</a>
{% endfor %}

The main menu is set up in Content > Menus in the Shopify admin and displayed in the theme through the linklists object. Check that mega menu, filter or infinite scroll apps do not remove these links from the HTML.

Wix

Versions Wix Editor, Wix Studio and Velo, November 2026.

According to Wix's documentation, crawlable links are those in the site menu, hyperlinks in text, clickable elements (button, image) connected with the link tool, and collection URLs connected through a dataset. Other methods, such as navigation triggered by Velo code (wixLocation.to()), do not guarantee an href link. Every page must be reachable through at least one crawlable link.

Laravel

Versions Laravel 11 to 13, Livewire 3 and 4, Inertia 2 and 3.

In Blade, generate URLs with named routes:

<a href="{{ route('produits.show', $produit) }}">{{ $produit->nom }}</a>
  • Livewire: wire:navigate is added to an <a href> and keeps the link crawlable; a wire:click that redirects is not a link.
<a href="{{ route('produits.index') }}" wire:navigate>All products</a>
  • Inertia: the <Link href="..."> component produces an <a href>. Without Inertia's server-side rendering, these links only exist after JavaScript runs: turn on SSR so that the navigation is in the initial HTML.

Next.js

Versions Next.js 15 and 16; the advice about server components and the layout applies to the App Router.

The Link component produces an <a href> and adds client-side navigation:

import Link from 'next/link';

export default function Menu() {
  return (
    <nav aria-label="Main navigation">
      <Link href="/chaises">Chairs</Link>
      <Link href="/tables">Tables</Link>
    </nav>
  );
}

Render the menu in a server component or in the layout, not in a client component that fetches its list with fetch after loading. Keep router.push() for redirects after an action (form submission), not for navigation.

Nuxt

Versions Nuxt 3 and 4.

<NuxtLink to="/chaises"> produces an <a href="/chaises">. For an external link, it also produces a full <a href>. Build menus from data fetched with useFetch or useAsyncData, which run on the server during the first render, and not in an onMounted hook, which only runs in the browser.

Astro

Versions Astro 5 to 7.

Astro produces HTML: write plain <a href> links. Island components loaded with client:only are not rendered on the server; do not put the main navigation in them.

React, Vue, Angular and SvelteKit

  • React Router: <Link to="/chaises"> produces an <a href>. Use createBrowserRouter or BrowserRouter, not HashRouter.
  • Vue Router: <RouterLink to="/chaises"> produces an <a href>. Create the router with createWebHistory(), not createWebHashHistory().
  • Angular: put routerLink on an <a> element, which then receives an href. On a <button> or a <div>, routerLink does not create a link. Do not turn on fragment routing (withHashLocation()).
<a routerLink="/chaises" routerLinkActive="actif">Chairs</a>
  • SvelteKit: write <a href> links; the router intercepts them automatically.

In all these cases, without server-side rendering or pre-rendering, the links only exist after JavaScript runs. See Prefer SSR or SSG for critical content (opens in a new tab).

Common mistakes

  • Building the menu in JavaScript from an API: the site looks navigable to visitors but is not for crawlers that read the initial HTML.
  • Fragment routing: #/produits/12 is not a separate URL for a search engine. Switch to the History API.
  • href="#" with a click handler: the crawler sees a link to the page itself.
  • Links to redirected or non-canonical URLs: they waste crawling. Point directly to the final URL.
  • Submenus loaded on hover: the crawler does not hover over anything; the submenu must be in the HTML.
  • Pagination replaced by a button: page 2 and the following pages are no longer discovered.
  • Relying on the sitemap: it helps discovery, but does not replace internal linking, which also indicates the relative importance of pages.

Frequently asked questions

Are URLs with a # indexed separately?

No, a URL with a fragment, such as example.com/#/chaises, is treated as the page example.com/. Google asks you not to use fragments to load different content and recommends the History API, which gives each view a real URL. In-page anchors pointing to a section, such as #livraison, remain useful for readers, but do not create a separate page.

Updated on

Topic checklist (PDF)

And now?

In the “JavaScript and HTML rendering” topic

  1. Inspect the initial HTML
  2. Compare initial HTML and rendered DOM
  3. Test rendering in Search Console
  4. Prefer SSR/SSG for critical content if relevant
  5. Make content accessible without user interaction
  6. Make links available in HTML with href
  7. Avoid links that rely solely on JS events
  8. Check title, description and canonical after rendering
  9. Check rendered structured data
  10. Fix JS and hydration errors
  11. Check content loaded via API
  12. Check dynamic pagination
  13. Check SPA HTTP status codes
  14. Avoid information available only in Canvas
  15. Test which information is accessible without JS