JavaScript Rendering and Indexing: What Must Be in the Initial HTML
Modern search engines can execute JavaScript, but rendering is an extra step that happens after the initial HTML is fetched, and it may not happen immediately. Pages that depend entirely on client-side code are more fragile: any failed request, blocked script or unsupported pattern can leave the crawler with an empty page.
How rendering fits into crawling
Google fetches the HTML, processes what it can directly, and queues the page for rendering with a recent version of Chromium. Content and links added by scripts are only seen after rendering. Resources blocked by robots.txt, such as an API endpoint or script bundle, cannot be used during rendering.
If the initial HTML contains a noindex directive, the page may not be rendered at all, so removing noindex with JavaScript does not work.
Signals that belong in the initial HTML
Put the title, meta description, canonical link, robots directives and structured data in the server response whenever possible. These signals are cheap to read before rendering and avoid contradictions between the raw and rendered versions of a page.
Server-side rendering or static generation for the main content gives crawlers and slow devices a usable page immediately, while scripts can still add interactivity afterwards.
Crawlable links and content
Crawlers discover pages through anchor elements with an href attribute. Navigation built from click handlers on other elements, or URLs that only differ in a fragment after the hash sign, is not reliably followed.
Test pages with a rendering tool from a search console and compare the rendered HTML with what users see in a browser.
<!-- Followed -->
<a href="/guides/rendering/">Rendering guide</a>
<!-- Not reliably followed -->
<span onclick="go('/guides/rendering/')">Rendering guide</span>