---
import { l, t, astroI18n } from "astro-i18n";

const currentLocale = astroI18n.langCode;

import "../../styles/style.css";

import BaseLayout from "../../layouts/BaseLayout.astro";
import ContentPost from "../../components/ContentPost.astro";

const allPosts = await Astro.glob(`./**/*.mdx`);
const localizedPost = allPosts.filter((post) => {
	return post.frontmatter.lang === currentLocale;
});

const pageTitle = t("index.articles.pageName");
---

<BaseLayout pageTitle={pageTitle}>
	<h2>{t("index.articles.pageName", { cool: "yes" }, "fr")}</h2>
	<p>{t("index.articles.trad")}</p>
	<ul>
		{
			localizedPost.map((post) => (
				<li>
					<ContentPost url={post.url} title={post.frontmatter.title} />
				</li>
			))
		}
	</ul>
</BaseLayout>
