getStaticPaths
getStaticPaths
is a bit special in Astro. On one hand it’s absolutely necessary for dynamic SSG
routes but it runs before everything, even middlewares.
Under the hood, the package uses a middleware so we can’t access any of the standard utilities inside
of getStaticPaths
. Instead, we provide a getLocalePlaceholder
function that is a build time macro.
That means it will be replaced by it’s literal value. For instance:
Will be replaced by the following, no matter the context:
Be careful not to use getLocalePlaceholder
in interpolations or it could result in invalid code.