website-astro/src/pages/articles/[slug].astro

26 lines
645 B
Plaintext
Raw Normal View History

2022-12-22 11:01:52 +01:00
---
2022-12-26 23:15:27 +01:00
import { l, t, astroI18n } from "astro-i18n";
astroI18n.init(Astro);
2022-12-22 11:01:52 +01:00
2022-12-26 23:15:27 +01:00
import { getCollection } from "astro:content";
import EditorialContent from "../../components/EditorialContent.astro";
2022-12-22 11:01:52 +01:00
2022-12-26 23:15:27 +01:00
import BaseLayout from "../../layouts/BaseLayout.astro";
2022-12-22 11:01:52 +01:00
2022-12-26 23:15:27 +01:00
export async function getStaticPaths() {
const articles = await getCollection("articles", ({ data }) => {
return data.lang === astroI18n.langCode;
2022-12-22 11:01:52 +01:00
});
2022-12-26 23:15:27 +01:00
return articles.map((article) => ({
2023-02-03 11:21:01 +01:00
params: { slug: article.slug },
2022-12-26 23:15:27 +01:00
props: { article },
}));
2022-12-22 11:01:52 +01:00
}
2022-12-26 23:15:27 +01:00
const { article } = Astro.props;
2022-12-22 11:01:52 +01:00
---
2022-12-26 23:15:27 +01:00
<BaseLayout pageTitle={article.data.title}>
<EditorialContent content={article} />
2022-12-22 11:01:52 +01:00
</BaseLayout>