S

super-dev — full-stack

@super-dev.app · Full-stack · ★ open to work
12.8k subscribers·47 videos·Active since 2017

Full-stack .NET / Angular dev with a DevOps streak on Azure Cloud. Also fluent in Flutter + Firebase. I build products, ship them, and keep them healthy.

Back to articles
AZURE
AZURE

Deploy a prerendered (SSG) Angular SPA to Azure Static Web Apps

Article 1 of 6 — Azure DevOps from scratch
Prerender, Container Apps, secrets, CI/CD, Docker, observability: ship to Azure without a server or the pain.

A plain Angular SPA serves a blank page to crawlers: until the JS runs, there's nothing to index. Static site generation (SSG) fixes this by prerendering every route to HTML at build time. Paired with Azure Static Web Apps , you get a serverless, instant, and perfectly indexed site.

Native prerender, no Node server

With @angular/ssr , the outputMode: 'static' mode prerenders all routes at compile time and emits only static files — no Node server to host. That's what makes deploying to Azure SWA trivial: you push a browser/ folder.

YAML
1# angular.json — build target excerpt
2"outputMode": "static",
3"prerender": true,
4"ssr": {
5 "entry": "src/server.ts"
6}

The parameterized-route trap

A :lang parent route with a functional redirectTo breaks prerendering: the <router-outlet> comes out empty. The fix is to expose two explicit static trees ( /fr and /en ) rather than a parameter. Language becomes a URL prefix, not a param.

Configuring Azure Static Web Apps

Azure SWA reads a staticwebapp.config.json file at the deployment root. The SPA fallback is essential so that client routing takes over for non-prerendered routes, instead of returning a 404.

YAML
1# staticwebapp.config.json (equivalent)
2navigationFallback:
3 rewrite: /index.html
4 exclude:
5 - /assets/*
6 - /*.{css,js,png,svg}
7mimeTypes:
8 .json: application/json

Full SEO at compile time

A post-build script generates sitemap.xml , robots.txt and llms.txt , while the SeoService sets <title> , Open Graph tags, canonical , hreflang and the BlogPosting JSON-LD route by route. Since everything lives in the prerendered HTML, crawlers and AI grab the content without running a single line of JS . The Azure docs cover the config in the Static Web Apps configuration guide.

SSG isn't just an SEO optimization: it's a site that paints before the JS is even downloaded. Time-to-content becomes independent of the visitor's connection.
super-dev — portfolio.app
// More in AZURE
Deploying a .NET API to Azure Container Apps
8 min • 2.4k reads
Zero-config secrets: Key Vault + Managed Identity
7 min • 1.7k reads