41 lines
1 KiB
Text
Executable file
41 lines
1 KiB
Text
Executable file
---
|
|
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 articles = await getCollection("articles", ({ data }) => {
|
|
console.log(langCode);
|
|
return data.lang === langCode;
|
|
});
|
|
return articles.map((article) => ({
|
|
params: { id: article.data.permalink },
|
|
props: { article },
|
|
}));
|
|
},
|
|
import.meta.url
|
|
);
|
|
|
|
// export async function getStaticPaths() {
|
|
// const articles = await getCollection("articles", ({ data }) => {
|
|
// console.log(astroI18n.langCode);
|
|
// return data.lang === astroI18n.langCode;
|
|
// });
|
|
// console.log(articles);
|
|
|
|
// return articles.map((article) => ({
|
|
// params: { slug: article.data.permalink },
|
|
// props: { article },
|
|
// }));
|
|
// }
|
|
|
|
const { article } = Astro.props;
|
|
---
|
|
|
|
<BaseLayout pageTitle={article.data.title}>
|
|
<EditorialContent content={article} />
|
|
</BaseLayout>
|