Skip to content

Feature Request: Native SSG Pre-rendering for Dynamic CMS Routes & SEO Files #6174

Description

@webstudio-issue-reporter

User story

As a user building a static site with Webstudio and a headless CMS (Directus), I want the SSG template to automatically pre-render dynamic routes based on attached Resources, natively handle 404.html, and process SEO/redirect files for static deployment, so that I don't have to write custom patch scripts.

Summary

Propose universal SSG rendering improvements for dynamic sites with headless CMS.

What the agent tried

  1. Export project using --template ssg
  2. Observe missing dynamic routes in generated static files

Expected behavior

  1. Path Parameter Sources: Add a setting to allow assigning a Resource (API) as the Path Provider for dynamic routes. The CLI could automatically generate an +onBeforePrerenderStart.ts hook for Vike to fetch the slugs during build. 2. Native 404: Map Webstudio's catch-all route (app/__generated__/$.tsx) to Vike's pages/_error route to output a standard 404.html. 3. Support generating non-HTML assets (sitemap.xml) and parse $resources.redirects.ts into a _redirects file for Cloudflare Pages during the build step.

Actual result

Currently, --template ssg only pre-renders static HTML files. Dynamic routes (e.g. /tattoo/@slug) populated by CMS connections are ignored because the compiler does not fetch slugs at build time. SEO files (sitemap.xml, llms.txt, _redirects) and 404 pages are skipped or not properly generated for static deployment like Cloudflare Pages.

Recovery attempts

  1. Created custom patch-ssg-routes.js script to dynamically inject Vike folders and onBeforePrerenderStart.ts hooks
  2. Created custom generate-static-xml.js to handle sitemap and redirects

User impact

High friction and manual script writing required to deploy fully functional static sites from dynamic CMS data.

Technical context

Webstudio Vike SSG template lacks native support for fetching dynamic paths at build time from attached Resources, requiring manual workarounds.

Agent environment

  • Client: antigravity
  • Provider: unknown
  • Model: gemini
  • Reasoning effort: unknown
  • Trigger: user-requested
  • Category: feature-request

Technical runtime

  • CLI: 0.291.0
  • Node.js: 24.18.0
  • Operating system: win32 10 (x64)
  • Execution mode: mcp
  • API contract: public-api:iqd6ok

Acceptance criteria

  1. Add UI setting for Path Parameter Sources
  2. Automatically generate onBeforePrerenderStart.ts hook for dynamic routes
  3. Map catch-all route to _error for 404 generation
  4. Support generating non-HTML files and _redirects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions