This is my slug file:
---
import fetchApi from '../lib/strapi';
import type Page from '../interfaces/page';
import Layout from '../layouts/Layout.astro';
export async function getStaticPaths() {
const pages = await fetchApi<Page[]>({
endpoint: 'pages',
wrappedByKey: 'data',
});
return pages.map((page) => ({
params: { slug: page.attributes.slug },
props: page,
}));
}
type Props = Page;
const page = Astro.props;
---
<Layout title={page.attributes.title}>
<section>
<div class='prose prose-base mx-auto'>
<h1>{page.attributes.title}</h1>
</div>
</section>
</Layout>