website-astro/src/pages/articles/index.astro

32 lines
748 B
Plaintext
Raw Normal View History

2022-12-02 11:21:18 +01:00
---
2022-12-05 20:50:35 +01:00
import { l, t, astroI18n } from "astro-i18n";
const currentLocale = astroI18n.langCode;
2022-12-02 17:29:11 +01:00
2022-12-02 11:21:18 +01:00
import "../../styles/style.css";
import BaseLayout from "../../layouts/BaseLayout.astro";
import ContentPost from "../../components/ContentPost.astro";
2022-12-05 20:50:35 +01:00
const allPosts = await Astro.glob(`./**/*.mdx`);
const localizedPost = allPosts.filter((post) => {
return post.frontmatter.lang === currentLocale;
});
2022-12-02 17:29:11 +01:00
const pageTitle = t("index.articles.pageName");
2022-12-02 11:21:18 +01:00
---
2022-12-05 20:50:35 +01:00
<BaseLayout pageTitle={pageTitle}>
2022-12-02 17:29:11 +01:00
<h2>{t("index.articles.pageName", { cool: "yes" }, "fr")}</h2>
<p>{t("index.articles.trad")}</p>
2022-12-02 11:21:18 +01:00
<ul>
{
2022-12-05 20:50:35 +01:00
localizedPost.map((post) => (
2022-12-02 11:21:18 +01:00
<li>
<ContentPost url={post.url} title={post.frontmatter.title} />
</li>
))
}
</ul>
</BaseLayout>