#Static content with dynamic slug

2 messages · Page 1 of 1 (latest)

echo swift
#

Hey, is it possible to have a dynamic slug pointing to a single static file?

So keeping it completely static in Astro, as thought.. then load dynamic data client side.

Best regards

granite dragon
#

If you're using SSG, then there's no routing. You'll use getStaticPaths() in your .astro files, which will generate all your static pages (routes) at build time. When a user goes to a "route", they get served static html.
You can use "hybrid" mode and make one or more pages SSR, where src/pages/myroute/[...slug].astro would get anything like:

/myroute/page1
/myroute/page2

and you can server-side render accordingly.
https://docs.astro.build/en/guides/server-side-rendering/#configure-server-or-hybrid