SEO & AEO

JavaScript SEO Basics for Modern Business Websites

How Google crawls, renders and indexes JavaScript sites: links, status codes, metadata, fragments, rendering choices and a checklist for developers and owners.

By Biply Team · · 5 min read

Modern sites are built with JavaScript frameworks, and search engines can handle them, but the margin for error is thinner than with plain HTML. Most JavaScript SEO problems are mundane: a link that is not a link, a missing status code, a page that only exists after a click. The documentation tells you what Google needs, and it is short.

The short answer: make every page reachable by a real URL, use a elements with href for links, return meaningful HTTP status codes, set titles and descriptions per page, avoid fragments for content and do not block the scripts a page needs. Prefer server-side rendering or static output for important content because it works for more than one crawler.

A disclosure: Biply builds sites with several approaches, including static and code-based frameworks, and offers SEO. We use Google’s JavaScript SEO documentation as the source and do not claim results for any framework.

What Google documents

  • Google processes JavaScript web apps in three phases: crawling, rendering and indexing. Pages with a 200 status code are queued for rendering; rendering may be skipped for non-200 pages and is not done for blocked files or pages.
  • Server-side or pre-rendering is still a great idea, because not all bots can run JavaScript.
  • Links must be a elements with an href attribute to be found.
  • Use meaningful status codes: 404 for missing pages and 401 for login-protected ones. In single-page apps, soft 404 fixes include a JavaScript redirect to a 404 URL or adding noindex to error pages.
  • Titles, descriptions and canonicals can be set with JavaScript, but you should not change a canonical to something different from the URL you specified.
  • Do not use fragments to load different content; use the History API.
  • If Google encounters noindex, it may skip rendering and JavaScript execution.
  • Lazy-loading is a good strategy, with separate guidelines.

A checklist for owners and developers

Check What to look for Why
Real URLs Every important view has its own URL Pages need addresses to be indexed
Links a with href, not click handlers on other elements Google finds links in href attributes
Status codes Missing pages return 404, not 200 Prevents soft 404s
Metadata Unique title and description per page See title tags and descriptions
Content in HTML Key text present without user interaction Robustness across crawlers
Blocked resources Scripts and CSS not disallowed Rendering needs them
Fragments Not used for content Not supported
Canonicals Set once, correctly See canonical tags

How to test

Use Search Console’s URL Inspection tool on a few representative URLs to see the rendered page Google has, compare it with what you expect and check the crawl and index status. Look at the page source for the content you care about; if it is missing before JavaScript runs, you rely on rendering. Our technical SEO checklist shows where this fits.

Rendering choices in plain language

Approach What it means Trade-off
Static output Pages are built ahead of time as HTML Simple and robust; rebuild on change
Server-side rendering HTML is generated per request Fresh content; needs a server
Client-side only The browser builds the page from scripts Most dependent on rendering; more to test
Islands and partial hydration HTML first, scripts only where needed Fits content sites; see Astro vs Webflow

Rendering trade-offs, from web.dev

web.dev’s “Rendering on the Web” defines server-side rendering as rendering on the server to send HTML instead of JavaScript, client-side rendering as using JavaScript in the browser to modify the DOM and static rendering as happening at build time. It says SSR generally produces a fast first contentful paint but can increase time to first byte and compute cost, static rendering gives a consistently fast time to first byte but needs an HTML file for every URL, and client-side rendering tends to grow its JavaScript with the application, which can affect INP. It notes SSR is a popular choice for a complete-looking experience that crawlers can interpret, and suggests considering whether static or server rendering can get you most of the way. For a typical marketing site, that points to HTML first.

A hypothetical fault

A single-page site shows a friendly “page not found” message for bad URLs but returns a 200 status. Search Console reports soft 404s for hundreds of URLs. The fix is not content; it is to return a real 404 status for unknown routes, or to add noindex to the error view, as Google describes. Then the old URLs are handled according to your redirect map.

Questions for your developer

  • Which pages need JavaScript to show their main content?
  • What does the page source contain before scripts run?
  • Which status code does an unknown URL return?
  • Are internal links real a elements with an href?
  • Do any scripts or stylesheets that pages need appear in robots.txt rules?
  • How are titles, descriptions and canonicals set, and are they different per page?

Next steps

If you want a JavaScript site reviewed for crawlability, see our SEO + AEO service and contact us. For error handling, read HTTP status codes, 404s and soft 404s.

Sources

FAQ

Frequently asked questions

Can Google index JavaScript websites?

Yes. Google says it processes JavaScript web apps in three phases: crawling, rendering and indexing. Pages with a 200 status are queued for rendering, but it will not render JavaScript from blocked files or on blocked pages.

Do I need server-side rendering?

Google calls server-side or pre-rendering still a great idea, because not all bots can run JavaScript. It is a robustness choice, not a requirement for Google.

What kind of links does Google follow?

Google says it finds links in a elements with an href attribute. Links added with JavaScript can work if they follow those practices.

How do I avoid soft 404s in a single-page app?

Google suggests redirecting with JavaScript to a URL that returns a 404 status, or adding a noindex robots meta tag to error pages with JavaScript.

Can I set titles and canonicals with JavaScript?

Titles and meta descriptions can be set with JavaScript. A canonical can also be set that way, but Google says not to use JavaScript to change the canonical to something different from the URL you specified.

Keep reading

Cookie settings

Choose which cookies we can use. You can change this at any time from “Cookie settings” in the footer.

Strictly necessary

Always on

Needed for the site to work and to remember your cookie choice. They do not track you.

Help us measure visits, traffic sources (including AI assistants) and how pages are used: Google Analytics 4, Microsoft Clarity and Searchable Analytics. See the cookie policy for details.