---
export const prerender = true;

export async function getStaticPaths() {
  try {
    const { getPostSlugs } = await import("../../lib/cms");
    const slugs = await getPostSlugs();
    return (slugs ?? []).map((slug) => ({ params: { slug } }));
  } catch {
    return [];
  }
}

const { slug } = Astro.params as { slug: string };
return Astro.redirect(`/post/${encodeURIComponent(slug)}`);
---
