How-to guides

Most of the site is how-tos, and they share one rule: a guide ends with a number. Configuration alone is cheap to publish and easy to get subtly wrong, so every how-to here shows the setup it was measured on, what changed, and by how much — a versioned Docusaurus build that went from 1 min 50 s to 58 s, a mobile LCP that moved from 2.9 to 1.7 seconds after a migration, a Hugo cold build cut from 131 to 34 seconds.

They are grouped below by topic, in the same order as the sections of the site, so tasks that belong together sit together: caching the build, then deploying only what changed, then rolling back when it goes wrong. Each entry carries its one-line summary so you can tell two similar-looking guides apart before you open either.

The structure shared by the how-to guides Five layers from top to bottom. Context states the task and who it is for. Prerequisites list what must already be in place. The recipe gives the configuration and commands. Measured impact reports before and after numbers. Pitfalls and rollback say what goes wrong and how to undo it. What every how-to contains Context the task and the site it was done on real site, real sizes Prerequisites versions and access needed pinned versions Recipe configuration and commands copyable, complete Measured impact before and after numbers tool named for each Pitfalls and rollback what breaks, how to undo every change reversible
The measured-impact table is the part that distinguishes a guide here from a snippet elsewhere.

Accessibility for Static Sites

Number of how-tos per topic, largest first Horizontal bars. Migrating Between Static Site Generators 12, CDN Caching Rules for SSGs 11, Self-Hosting Static Sites on S3, Nginx and Caddy 11, Image Optimization Pipelines in Astro 10, GitHub Actions for Automated SSG Builds 10, Security Headers and Hardening for Static Sites 10, Docs Frameworks: Docusaurus, Starlight and VitePress 9 and Hugo Build Times for Large Repositories 9. Topics with the most how-tos Migrating Between Static Site Generators 12 CDN Caching Rules 11 Self-Hosting Static Sites on S3, Nginx… 11 Image Optimization Pipelines in Astro 10 GitHub Actions for Automated SSG Builds 10 Security Headers and Hardening 10 Docs Frameworks: Docusaurus, Starlight… 9 Hugo Build Times for Large Repositories 9
The 8 topics with the most how-tos, out of 32 topics that have any.

Astro vs Eleventy for Documentation Sites

Docs Frameworks: Docusaurus, Starlight and VitePress

Hugo Build Times for Large Repositories

Internationalization for Static Sites

Jekyll Plugin Ecosystem

Migrating Between Static Site Generators

Next.js Static Export for Content Sites

Search for Static Sites

  • Accessible Search UI for Static SitesBuild a static site search dialog that works with keyboards and screen readers: dialog semantics, result lists, live result counts and focus handling.
  • Adding Pagefind to an Astro SiteAdd Pagefind search to a plain Astro site: post-build indexing, content boundaries, heading weights, a lazy-loaded UI and a CI relevance check.
  • Building a Lunr Index at Build Time in EleventyGenerate a prebuilt Lunr search index from Eleventy collections, keep it small with field boosts and stop words, and load it only when readers search.
  • Customizing the Pagefind UIMake Pagefind's search UI match your design system: theme variables, filters, result metadata, a modal trigger, or a custom UI on the JavaScript API.
  • Indexing Hugo Sites with PagefindAdd fast, serverless search to a Hugo site with Pagefind: template attributes, taxonomy filters, multilingual output, CI integration and measured build cost.
  • Multilingual Search on Static SitesBuild per-language search for a static site: language detection, stemming, compound words, CJK segmentation and keeping each locale's index small.
  • Search Index Size Budgets for Large DocsSet a byte budget for static search on large documentation sites, measure first-query cost on real phones, and trim indexes that have quietly grown too big.
  • Self-Hosting Typesense for a Static SiteRun Typesense as search for a large static site: index from the build, scoped search keys, typo tolerance, facets, cost and when Pagefind is enough.
  • Tracking Zero-Result SearchesLog searches that return nothing on a static site with Pagefind or a search server, respect privacy, and turn the weekly report into synonyms and new content.

Technical SEO for Static Sites

CDN Caching Rules for SSGs

CSS and JavaScript Asset Optimization

Cumulative Layout Shift Fixes for Static Sites

  • Measuring CLS in the Field With web-vitals.jsCollect real-user CLS from a static site with the web-vitals attribution build, send it to an edge endpoint, and turn a 75th-percentile score into a named element to fix.
  • Reserving Space for Ad and Promo SlotsStop ad units, sponsor blocks and promo banners from shifting a static site: size slots per breakpoint, handle empty fills, and render promos at build time.
  • Reserving Space for Images and EmbedsStamp intrinsic dimensions on every image, wrap iframes in an aspect-ratio box, and handle art-directed sources — the build-time recipe that takes body-image CLS from 0.31 to 0.01.

Font Loading Strategies for Static Sites

Image Optimization Pipelines in Astro

JavaScript Hydration & Partial Rendering

  • Breaking Up Long Tasks on Static SitesFind long tasks that hurt INP on a static site, split them with scheduler.yield and idle callbacks, move work off the main thread, and measure the field result.
  • Deferring Hydration with client:visible in AstroUse client:visible, client:idle and client:media to delay Astro island hydration until it is needed, cut startup JavaScript and protect INP on content pages.
  • How to Reduce Bundle Size in Eleventy BuildsCut JavaScript in Eleventy builds — scope scripts per route, tree-shake and bundle with esbuild, and defer third-party code. Concrete before/after KB numbers.
  • Measuring INP on Static Sites with RUMMeasure Interaction to Next Paint in the field with the web-vitals library and a RUM beacon, attribute INP to specific interactions, and reconcile lab versus field data.
  • Replacing React Islands with Web ComponentsSmall interactive widgets rarely need React. Rewriting islands as custom elements removes the framework runtime, cuts JavaScript and improves INP.
  • Server Islands in AstroUse Astro server islands to add small per-request parts to a static page, such as stock or account state, with fallbacks, caching headers and measured costs.

Largest Contentful Paint Optimization for Static Sites

  • Improving TTFB for Static HTMLCut time to first byte for a static site’s HTML: edge caching of HTML, redirect hops, TLS and protocol settings, origin placement and 103 Early Hints, measured in the field.
  • Measuring LCP Subparts with DevToolsSplit Largest Contentful Paint into TTFB, load delay, load duration and render delay in DevTools and field data, so you fix the part that is actually slow.
  • Optimizing LCP on Astro with Priority HintsUse fetchpriority="high", rel=preload, and Astro Image priority to load the hero first and cut LCP — with measured before/after numbers from Lighthouse and WebPageTest.
Number of how-tos in each section Vertical bars: Framework selection 75, Performance 68 and Deployment 102. As a share of all guides in the section: Framework selection 62%, Performance 66%, Deployment 83%. How-tos in each section 75 Framework selection 68 Performance 102 Deployment
245 how-tos in total. As a share of each section: framework selection 62%, performance 66%, deployment 83%.

Performance Budgets and Lighthouse CI

Resource Hints and Navigation Speed

  • Auditing Unused PreloadsFind preloads that waste bandwidth or compete with the LCP resource across a whole static site, remove them safely, and stop new ones creeping back in.
  • Early Hints (103) on CloudflareSend 103 Early Hints from Cloudflare for a static site so browsers start fetching CSS, fonts and the LCP image before the HTML arrives, and measure when it helps.
  • Fetchpriority Beyond the Hero ImageUse fetchpriority beyond the LCP image: demote carousels and decorative images, raise critical fetches, and measure the effect on LCP and INP.
  • Instant Navigation with Speculation RulesPrerender likely next pages on a static site with the Speculation Rules API: eagerness levels, exclusions, prerender-aware analytics and field results.
  • Prefetching Links in AstroConfigure Astro's built-in prefetch — strategies, defaults, per-link overrides and speculation rules — and measure what it does to navigation speed.
  • View Transitions in Astro Without Hurting VitalsAdd view transitions to an Astro site with the ClientRouter or native cross-document transitions, then keep LCP, INP and CLS intact with measured settings.
  • View Transitions on Multi-Page Static SitesAdd cross-document view transitions to a static site with CSS alone: opt-in rules, named elements, reduced motion, avoiding layout shift, and the measured cost.

Third-Party Script Performance on Static Sites

Cloudflare Pages Edge Caching Setup

Content Workflows for Documentation Teams

  • Checking Links in Pull RequestsCatch broken internal links and anchors before merge by checking the built site in CI with lychee, and handle external links without flaky failures.
  • Content Linting with markdownlintLint Markdown in a docs repository with markdownlint-cli2: tune rules, add custom rules for site conventions, autofix on commit and annotate pull requests.
  • Editorial Checks with Vale in CIRun Vale on every pull request to enforce your style guide, terminology and readability in Markdown docs, with inline review comments and a gradual rollout.
  • Managing Images in Docs-as-Code ReposKeep screenshots and diagrams in a docs repository without bloating Git: size limits, Git LFS, co-location, alt text checks and automated screenshots.
  • Release Notes and Changelogs from GitGenerate a changelog section for a static docs site from Git and conventional commits or changesets, with per-release pages, feeds and writer-edited release notes.
  • Scheduled Content Publishing With GitHub ActionsPublish reviewed pull requests at a set time with GitHub Actions, for embargoed launches and releases, with time zones, approvals and failed-build guards.
  • Scheduling Content Publication With Cron-Triggered BuildsPublish future-dated pages on a static site with no runtime: filter at build time, rebuild on a cron, skip no-op deploys, and keep embargoed content out of the artifact.
  • Wiring a Headless CMS to a Static BuildConnect a Git-backed or API-backed CMS to a static generator: content model, auth, webhook rebuilds, media handling, and keeping the repository the source of truth.

GitHub Actions for Automated SSG Builds

  • Building Astro Sites with GitHub ActionsA production GitHub Actions workflow for Astro: pinned Node, dependency and image caches, astro check, build artifacts and a deploy job that only runs on main.
  • Caching node_modules in GitHub ActionsCut SSG CI time by caching npm in GitHub Actions — actions/setup-node built-in cache vs actions/cache, lockfile-hash keys, and the install minutes you actually save.
  • Concurrency Groups to Cancel Stale BuildsUse GitHub Actions concurrency groups to cancel superseded static site builds on pull requests, serialize production deploys, and cut wasted CI minutes.
  • Deploying to GitHub Pages with ActionsDeploy any static site generator to GitHub Pages with the official Actions workflow: artifacts, base paths, custom domains and what Pages cannot do.
  • Deploying to Multiple Environments From One WorkflowBuild the artifact once and promote it to preview, staging and production with environment-scoped secrets, approvals and per-environment config injected at deploy time.
  • GitHub Actions for Hugo DeploymentsDeploy Hugo with GitHub Actions using the extended edition for SCSS and WebP — a two-job build-and-publish pipeline, resource caching, and the Hugo-specific gotchas.
  • Matrix Builds for Multi-Site MonoreposBuild and deploy only the sites a change affects in a monorepo, using a dynamic GitHub Actions matrix generated from changed paths, with per-site caches.
  • Pinning Actions by Commit SHAPin third-party GitHub Actions in static site workflows to full commit SHAs, keep them updated with Renovate or Dependabot, and restrict which actions may run.
  • Publishing Any Generator to GitHub Pages With ActionsOne reusable GitHub Actions workflow that publishes Hugo, Astro, Eleventy, Jekyll or VitePress sites to GitHub Pages, with base paths, caching and a 404 page.
  • Reusable Workflows for SSG BuildsShare one build, test and deploy pipeline across many static sites with GitHub Actions reusable workflows and composite actions, versioned and called by tag.

Incremental Builds and Build Caching for SSGs

  • Build Caching on Netlify and VercelMake Netlify and Vercel reuse dependency, framework and image caches between static site builds, verify cache hits in logs, and measure the savings.
  • Caching Hugo Builds in GitHub ActionsCache Hugo resources/_gen and the module cache in GitHub Actions with content-hashed keys. Includes the workflow, cache key design, and measured CI minutes saved.
  • Deploying Only Changed FilesUpload only the files that changed in a static site deploy using content hashes, rsync or S3 sync with checksums, while keeping the deploy atomic and purges scoped.
  • Enabling Incremental Builds in EleventyUse Eleventy --incremental and --ignore-initial to rebuild only changed templates. Covers the programmatic API, what gets rebuilt, and measured rebuild times.
  • Incremental Builds in Astro with the Content LayerHow the Astro content layer caches entries between builds, how to write loaders with digests, and how to persist the data store in CI so builds stay fast.
  • Measuring Build-Time Regressions in CITrack build duration per commit, separate cache misses from real slowdowns, and set a budget that fails a pull request before a 4-second build becomes a 4-minute one.
  • Remote Caching with Turborepo for SSG MonoreposUse Turborepo task hashing and a remote cache to skip rebuilding unchanged sites and packages in a static site monorepo, locally and in CI.
  • Sharing Build Cache Across CI RunnersShare a build cache across parallel CI runners with Turborepo remote cache, an S3-backed store, or scoped actions/cache. Architecture, signing, and measured savings.

Monitoring Static Sites in Production

  • Alerting on Cache Hit Ratio DropsMeasure CDN cache hit ratio for a static site by path prefix, alert on sharp drops against last week, and trace the usual causes: Vary, cookies, query strings.
  • Building a Core Web Vitals Dashboard from RUM DataCollect LCP, INP and CLS from real readers with web-vitals, store them cheaply at the edge, and chart p75 by template, device and deploy with attribution.
  • Crawling for Broken Links on a ScheduleRun a weekly crawl of a live static site with lychee, separate internal from external breakage, track link rot as issues, and keep false positives low.
  • Logging 404s at the EdgeCollect every 404 a static site serves at the CDN edge, rank paths by reader impact, separate bots from people, and turn the top of the list into redirects.
  • Monitoring TLS Certificate ExpiryCatch expiring or misconfigured TLS certificates on static site domains before readers do: inventory hostnames, check expiry and chains, and alert on renewal failures.
  • Real-User Error Tracking on Static SitesCapture JavaScript errors, failed resources and CSP violations from real readers of a static site with a tiny collector, filter noise from extensions, and alert on new errors.
  • Synthetic Monitoring With Scheduled Playwright ChecksRun Playwright checks against a live static site on a schedule: search, forms and navigation, with screenshots on failure, alert routing and run costs.
  • Tracking Deploy Markers in AnalyticsRecord every static site deploy as a marker in RUM, analytics and error dashboards, tag data with the build version, and link metric changes to commits.
  • Uptime and Synthetic Checks for Static SitesContent-aware synthetic checks for a static site: one URL per template, markers not just status codes, TLS expiry, two regions, and paging only on real outages.

Netlify vs Vercel Deployment Strategies

Preview Environments for Pull Requests

  • Automating Preview Deploy Pipelines with GitHub ActionsBuild an ephemeral per-PR preview pipeline in GitHub Actions — build the SSG, deploy to a unique URL, comment the link, and tear it down when the PR closes.
  • Cleaning Up Stale Preview DeploymentsPreview deploys accumulate: indexed by search engines, holding old secrets, and costing storage. Tear them down on merge, sweep the stragglers, and keep them out of the index.
  • Commenting on Preview DeploysPost one self-updating pull request comment per preview with the URL, changed pages, checks and screenshots, and collect reviewer feedback on the preview.
  • Password-Protecting Preview DeploymentsKeep pull request previews private with platform protection, Cloudflare Access or a small edge function, and keep them out of search indexes with noindex.
  • Preview Deploys for MonoreposBuild and preview only the static sites a pull request affects in a monorepo, with per-site preview URLs, shared package awareness and one combined comment.
  • Previewing Headless CMS DraftsShow editors unpublished headless CMS content on a static site: a draft build, on-demand preview routes, or a small preview server, and how to secure each.
  • Pull Request Previews for GitHub Pages SitesGive a GitHub Pages site a preview per pull request: deploy builds to a preview host or a subfolder, comment the URL, handle base paths and clean up on close.
  • Visual Regression Testing on Preview DeploysScreenshot key templates on every preview deploy with Playwright, compare them with main, and review diffs in the pull request without drowning in noise.

Rollbacks and Deploy Safety for Static Sites

Security Headers and Hardening for Static Sites

Self-Hosting Static Sites on S3, Nginx and Caddy

Serverless Functions for Static Sites

Testing Static Sites in CI

Other kinds of guide

  • FixesStarts from a symptom and ends at the cause and the fix.
  • ComparisonsWeighs two or more options against measured criteria.
  • ConceptsExplains how something works and when it matters.