Rendering

Static HTML twins

Generate static HTML copies of public pages for a single-page app so crawlers get full content at the same URL. Use when the app cannot move to server-side rendering and the host can serve files per path.

static-html-twins/SKILL.md

Goal

For each public route, serve a plain HTML file that holds the same content a user sees, at the same URL, then let the app take over in the browser.

Rules

  • Same content for users and bots. The twin must match the rendered page text. Different content for bots is cloaking.
  • Same URL. Do not create a separate /static/ path that competes with the real page.
  • One canonical per page, pointing to the real URL.

Workflow

  1. List the public routes from the router config and the sitemap. Skip routes that need a login.
  2. Render each route in a headless browser after the content loads.
  3. Save the HTML as <route>/index.html (for /pricing, save pricing/index.html) in the build output, so a static host serves it for that path.
  4. Make sure each file keeps the app's script tags so the app still loads and hydrates or mounts.
  5. Check <title>, meta description, canonical, Open Graph tags and JSON-LD in each file.
  6. Configure the host so a real file wins over the SPA fallback, and the fallback for unknown paths returns 404, not the home page with 200.
  7. Add the twin step to the build so twins never go stale.

Checks

  • curl of each route returns the full text.
  • The app still works when a user loads a route directly.
  • No twin exists for a route that the app no longer has.

Output

A list of generated files with word counts, and the build command or script that makes them.

Sources

  • Google: Understand JavaScript SEO basics. https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics
  • Google: Dynamic rendering as a workaround. https://developers.google.com/search/docs/crawling-indexing/javascript/dynamic-rendering
See all 30 skills