--- // init i18n import { l, t, astroI18n } from "astro-i18n"; astroI18n.init(Astro); import { getEntry } from "astro:content"; // import stuff import BaseLayout from "../layouts/BaseLayout.astro"; import QuickAccessCard from "../components/QuickAccessCard.astro"; import ListCards from "../components/ListCards.astro"; import CardEditorial from "../components/CardEditorial.astro"; const pageTitle = t("accueil"); // get all HP sections const allSections = await Astro.glob("../data/HP/**/*.md"); // only keep the right locale version const localizedSections = allSections.filter((section) => { return section.frontmatter.lang === astroI18n.langCode; }); // New astro content collections import { getCollection } from "astro:content"; // Only return posts with correct lang in the frontmatter const localizedArticles = await getCollection("articles", ({ data }) => { return data.lang === astroI18n.langCode && !data.draft; }); // sort articles by descending publication date const sortedArticles = localizedArticles.sort( (a, b) => b.data.createdAt - a.data.createdAt ); // Only return snippets with correct lang in the frontmatter const localizedSnippets = await getCollection("fragments", ({ data }) => { return data.lang === astroI18n.langCode && !data.draft; }); // sort articles by descending publication date const sortedSnippets = localizedSnippets.sort( (a, b) => b.data.createdAt - a.data.createdAt ); const localizedReferences = await getCollection("references", ({ data }) => { return data.lang === astroI18n.langCode && !data.draft; }); --- {t("index.subtitle")} { localizedSections.map( (section) => section.frontmatter.id && ( ) ) } { localizedSections.map((section) => ( {section.frontmatter.reference && ( { return ref.slug === section.frontmatter.reference; })} routeName={t("references.slug")} /> )} )) } {t("index.latestArticles")} {t("index.allArticles")} {t("index.latestSnippets")} {t("index.allSnippets")}
{t("index.allArticles")}
{t("index.allSnippets")}