Angular SEO: AngularJS crawlability, Angular SSR, prerendering and migration
An AngularJS page we tested served 121 words of HTML and 5,086 after rendering. Modern Angular can prerender or server-render every route. Setup, titles, canonicals, 404s and the AngularJS migration.

Angular SEO depends on which Angular you run. AngularJS (1.x) renders everything in the browser, uses #! URLs unless you switched them off, and lost support in January 2022 (AngularJS repository). Google can render it, but other crawlers see a near-empty page, and every fix means rewriting. Modern Angular (v2 and later) also renders on the client by default, but one CLI command adds server-side rendering and build-time prerendering per route (Angular). If your Angular site isn't indexed well, the fix is almost always to get the content into the HTML the server sends. The steps for both versions are below.
Check what your Angular app serves
Before changing anything, compare the HTML your server returns with the page after JavaScript has run. curl shows the first; Chrome's headless mode with --dump-dom shows the second, because it "executes any <script> that might alter the DOM" before serialising it.
URL='https://example.com/products/blue-widget'
curl -s "$URL" > raw.html
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
--headless --dump-dom --virtual-time-budget=10000 "$URL" > rendered.html # Linux: google-chrome
for f in raw.html rendered.html; do
echo "$f: $(grep -o -i '<title[^>]*>[^<]*' $f | head -1) | h1: $(grep -o -i '<h1' $f | wc -l) | links: $(grep -o -i '<a [^>]*href' $f | wc -l)"
done
Here is what that looks like on two real Angular sites, measured on 2 November 2026 with a small Python counter for visible words.
| Page | HTML from the server | After JavaScript |
|---|---|---|
AngularJS developer guide, docs.angularjs.org/guide/$location | title AngularJS, 121 words, 32 links | title AngularJS: Developer Guide: Using $location, 5,086 words, 119 links |
Angular docs, angular.dev/guide/ssr (prerendered) | title Server-side and hybrid-rendering • Angular, 4,388 words, 255 links | same title, 4,522 words, 284 links |
The AngularJS page sends a generic title and a skeleton; everything you'd want indexed arrives with JavaScript. Its <title> carries the unrendered template {{ currentArea.name }} in an ng-bind-template attribute. The modern Angular page sends the full article in its first response, and JavaScript adds a little navigation on top.
If your raw HTML looks like the first row, every crawler that doesn't run JavaScript, including most AI crawlers (background), gets nothing, and Google has to render every page to see your content. What can go wrong in that step is covered in Does Google crawl JavaScript?.
AngularJS crawlability: why 1.x sites struggle
Hashbang URLs
AngularJS's $location service runs in hashbang mode unless you call $locationProvider.html5Mode(true), and since AngularJS 1.6 the default hash prefix is !, so URLs look like example.com/#!/products/42 (AngularJS changelog). The part after # is never sent to the server.
That was workable while Google supported the AJAX crawling scheme, which mapped #! URLs to ?_escaped_fragment_= snapshots. Google's own troubleshooting page now says the scheme "has been deprecated since 2015, so you can't rely on URL fragments to work with Googlebot". Google wants the History API and real paths (Google). Some old AngularJS sites still answer ?_escaped_fragment_= with a snapshot; the AngularJS docs site did when we checked. It does no harm, but nothing in Google's crawl uses it.
Switch to path URLs with html5Mode, which needs a <base href="/"> and a server rewrite that sends every app path to index.html:
angular.module('app').config(['$locationProvider', function ($locationProvider) {
$locationProvider.html5Mode(true);
}]);
# nginx
location / {
try_files $uri $uri/ /index.html;
}
No server HTML, no status codes
Even with html5Mode, an AngularJS app returns the same index.html with status 200 for every path, including products that no longer exist. Google may index those error views or report soft 404s. Its documented workaround for client-rendered apps is to redirect with JavaScript to a URL that returns a real 404, or to add noindex from JavaScript on the error view (Google):
// in the controller or route resolve that loads the product
$http.get('/api/products/' + id).catch(function () {
$window.location.href = '/not-found'; // the server answers 404 for this path
});
Links
ng-click="go('/products/42')" on a <div> or <span> isn't a link to Google, which only follows <a> elements with an href (Google). Use <a ng-href="/products/{{p.id}}">.
Should you patch AngularJS or migrate?
AngularJS gets no fixes, and its GitHub repository was archived in April 2024 (GitHub). You can buy time with html5Mode, real <a href> links and a prerendering service, but every one of those is a patch on a framework that won't change again. If the site matters for search, plan the migration. The patches are worth doing first only if the migration is more than a few months away.
Modern Angular: CSR by default, SSR in one command
Angular's docs say: "Angular ships all applications as client-side rendered (CSR) by default", and client rendering "may negatively affect search engine optimization (SEO), as search crawlers have limits to how much JavaScript they execute when indexing a page". Add server rendering to a new or existing project with the CLI:
ng new my-app --ssr # new project
ng add @angular/ssr # existing project
After ng add, Angular "prerenders your entire application and generates a server file" by default. Hydration, which lets the browser reuse the server-rendered DOM instead of rebuilding it, is wired in automatically when you use the CLI (Angular).
Pick a render mode per route
Server routes live in app.routes.server.ts. Each route gets one of three modes (Angular):
RenderMode | What crawlers get | Use it for |
|---|---|---|
Prerender | Static HTML generated at build time | Marketing pages, docs, blog posts, product pages that change rarely |
Server | HTML rendered per request | Listings and pages whose data changes often |
Client | The empty app shell | Logged-in areas, dashboards, checkout |
A typical public site:
// app.routes.server.ts
import { inject } from '@angular/core';
import { RenderMode, ServerRoute, PrerenderFallback } from '@angular/ssr';
import { ProductService } from './product.service';
export const serverRoutes: ServerRoute[] = [
{ path: '', renderMode: RenderMode.Prerender },
{ path: 'about', renderMode: RenderMode.Prerender },
{
path: 'products/:slug',
renderMode: RenderMode.Prerender,
fallback: PrerenderFallback.Server, // new products render on request
async getPrerenderParams() {
const products = inject(ProductService); // inject before any await
const slugs = await products.allSlugs();
return slugs.map((slug) => ({ slug }));
},
},
{ path: 'account/**', renderMode: RenderMode.Client },
{ path: '**', renderMode: RenderMode.Server },
];
inject inside getPrerenderParams "must be used synchronously", so call it before any await. And a prerendered route with PrerenderFallback.Client serves the empty shell for any path you didn't list, which is the CSR problem again for new content. PrerenderFallback.Server (the default) avoids that.
Code that breaks on the server
Server rendering fails when components touch window, document, localStorage or navigator during render. Angular's guide says browser-only code belongs in afterNextRender or afterEveryRender, which "are only executed on the browser and skipped on the server", and warns against using isPlatformBrowser in templates to render different content on server and client, because that causes hydration mismatches. Expect to fix a handful of these when you add SSR to an older app; third-party widgets are the usual culprits.
Titles, meta descriptions and canonicals in Angular
With SSR or prerendering on, whatever you set during render ends up in the HTML. Without it, these tags exist only after JavaScript runs.
Titles. Give each route a title, either a string or a resolver (Angular):
// app.routes.ts
import { inject } from '@angular/core';
import { ResolveFn, Routes } from '@angular/router';
import { ProductService } from './product.service';
const productTitle: ResolveFn<string> = async (route) => {
const p = await inject(ProductService).bySlug(route.paramMap.get('slug')!);
return `${p.name} – Example Store`;
};
export const routes: Routes = [
{ path: '', component: Home, title: 'Example Store: handmade widgets' },
{ path: 'products/:slug', component: ProductPage, title: productTitle },
];
Meta tags. Use the Meta service. Prefer updateTag over addTag so client-side navigation doesn't stack duplicate descriptions:
import { Component, inject, input, effect } from '@angular/core';
import { Meta } from '@angular/platform-browser';
@Component({ selector: 'app-product-page', templateUrl: './product-page.html' })
export class ProductPage {
private meta = inject(Meta);
product = input.required<Product>();
constructor() {
effect(() => {
this.meta.updateTag({ name: 'description', content: this.product().summary });
});
}
}
Canonicals. Angular has no built-in canonical helper. Its SSR guide shows the pattern: inject DOCUMENT instead of touching the global document, and append the <link> during server rendering (Angular). Reuse the existing element so you never end up with two:
import { Injectable, inject, DOCUMENT } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class CanonicalService {
private doc = inject(DOCUMENT);
set(url: string) {
let link = this.doc.head.querySelector<HTMLLinkElement>('link[rel="canonical"]');
if (!link) {
link = this.doc.createElement('link');
link.rel = 'canonical';
this.doc.head.appendChild(link);
}
link.href = url;
}
}
Google asks that a canonical set by JavaScript match the one in the original HTML, or that the HTML leave it out entirely (Google). With SSR, the server HTML and the hydrated page run the same code, so they agree as long as the URL you pass doesn't depend on browser-only state.
Status codes and redirects in Angular SSR
A server-rendered Angular app can finally answer 404 for missing pages. For runtime decisions, inject RESPONSE_INIT, which Angular provides so you can "set headers and the status code for the response dynamically". It's null in the browser and during prerendering, so guard it:
import { Component, inject, RESPONSE_INIT } from '@angular/core';
@Component({ selector: 'app-not-found', template: '<h1>Page not found</h1>' })
export class NotFound {
constructor() {
const res = inject(RESPONSE_INIT, { optional: true });
if (res) res.status = 404;
}
}
Route the ** wildcard and any "product not found" branch to that component. For fixed per-route codes or headers, ServerRoute also accepts status and headers (Angular).
Redirects behave differently by mode. In SSR, redirectTo produces a real HTTP 301 or 302. In prerendered output, Angular writes "soft redirects" using <meta http-equiv="refresh">. Google treats an instant (0-second) meta refresh as a permanent redirect (Google), so it works, but for moved URLs that matter, configure the redirect on your web server or CDN as a 301.
Migrating from AngularJS to Angular without losing rankings
The rewrite is a code project; the SEO side is mostly about URLs.
- Inventory the URLs Google knows. Export pages from Search Console's Performance and Page indexing reports, plus your sitemap. If your AngularJS app used hashbang URLs, check whether Google shows any
#!URLs at all. Since fragments never reach your server, any redirect for those has to happen in JavaScript on the new app's home page. - Keep paths stable where you can. If AngularJS ran in
html5Modewith/products/42, use the same paths in Angular's router. Every changed URL needs a server-side301. - Migrate incrementally if the app is large. Angular's
UpgradeModulefrom@angular/upgrade/staticbootstraps "the hybrid upgrade application", so AngularJS and Angular can run side by side while you move routes over. Plan on the hybrid app rendering in the browser, and switch on SSR for routes once they're fully on modern Angular. - Turn on SSR or prerendering from the first release. Shipping the new app as CSR and adding SSR later means a second round of HTML changes for Google to recrawl, and a period where non-rendering crawlers still see an empty shell.
- Check the new HTML before launch. Run the curl and headless Chrome comparison above on one URL per template. Titles, H1s, canonicals and links should be in the raw HTML.
Pick a supported Angular version for the target. As of 2 November 2026, v22 is the active release and v21 is in long-term support until June 2027; v20's LTS ends on 28 November 2026, so don't start a migration on v20 or older (Angular releases).
Checking every template
Run the two-command test on one URL per template, not one URL per site: a product template, a category template, the blog. SEOFix does that across the whole site from the raw HTML its crawler fetches, so an Angular template that only fills in after JavaScript shows up as missing titles, H1s or links on every page of that template. On full audits where it's enabled, a render sample of up to 20 pages flags JS_DEPENDENT_CONTENT when the rendered page differs from the raw HTML (how the sample works). Issues are grouped by template (fixing by template), which matches how Angular sites break: one component, thousands of URLs.
FAQ
Is Angular good for SEO?
With SSR or prerendering, yes: crawlers get complete HTML and Angular's own docs say both modes have "excellent search engine optimization (SEO)". Without them, you rely on Google rendering every page and on other crawlers not mattering.
Can Google index an AngularJS site?
Google renders JavaScript, so a 1.x app with path URLs and real links can be indexed. Hashbang URLs, missing <a href> links and 200 error pages are what hold most AngularJS sites back.
Do I need SSR, or is prerendering enough?
Prerender pages whose content is known at build time. Use RenderMode.Server for pages that change between deploys, or prerender with PrerenderFallback.Server so new pages are server-rendered until the next build.
Does Angular hydration affect SEO?
Hydration doesn't change what crawlers receive; the server HTML is the same. It stops the browser from re-rendering the page on load, which Angular says avoids flicker and layout shift (Angular).
Moving off AngularJS or switching on SSR? Run a free audit before and after: SEOFix reads the HTML your server returns and shows which templates still depend on JavaScript.
Keep reading

React SEO for single-page apps: prerender, SSR, per-route meta tags and real 404s
A Vite or Create React App site sends the same empty shell for every URL. Prerendering with React Router, React 19's title and meta tags, and real 404 status codes fix most of it without a rewrite.
1,666 words · 8 min read

Duplicate without user-selected canonical: which page Google kept, and how to set canonicals by template
Google found two URLs with the same content, neither declared a canonical, so Google picked one. How to check its choice, find where the variants come from, and set canonicals in Next.js and WordPress.
1,762 words · 8 min read

Trailing slash SEO: pick one form, redirect the other, and make every layer agree
/about and /about/ are two URLs to Google. Neither form ranks better; what hurts is serving both, or having two layers that each redirect the other way. Framework defaults, server config and a curl test.
1,494 words · 7 min read