34 lines
962 B
Text
34 lines
962 B
Text
---
|
|
import { createStaticPaths } from "astro-i18n";
|
|
|
|
import { getCollection } from "astro:content";
|
|
import EditorialContent from "../../components/EditorialContent.astro";
|
|
|
|
import BaseLayout from "../../layouts/BaseLayout.astro";
|
|
|
|
export const getStaticPaths = createStaticPaths(async ({ langCode }) => {
|
|
const snippets = await getCollection("fragments", ({ data }) => {
|
|
return data.lang === langCode;
|
|
});
|
|
return snippets.map((snippet) => ({
|
|
params: { slug: snippet.data.permalink },
|
|
props: { snippet },
|
|
}));
|
|
}, import.meta.url);
|
|
|
|
// export async function getStaticPaths() {
|
|
// const snippets = await getCollection("fragments", ({ data }) => {
|
|
// return data.lang === astroI18n.langCode;
|
|
// });
|
|
// return snippets.map((snippet) => ({
|
|
// params: { slug: snippet.slug },
|
|
// props: { snippet },
|
|
// }));
|
|
// }
|
|
|
|
const { snippet } = Astro.props;
|
|
---
|
|
|
|
<BaseLayout pageTitle={snippet.data.title}>
|
|
<EditorialContent content={snippet} />
|
|
</BaseLayout>
|