---
// init i18n
import { l, t, astroI18n } from "astro-i18n";
astroI18n.init(Astro);
// import stuff
import BaseLayout from "../layouts/BaseLayout.astro";
import QuickAccessCard from "../components/QuickAccessCard.astro";
import ListCards from "../components/ListCards.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
);
---
{t("index.subtitle")}
{
localizedSections.map((section) => (
-
))
}
{
localizedSections.map((section) => (
))
}