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

32 lines
739 B
Plaintext

---
import { l, t, astroI18n } from "astro-i18n";
import "../../styles/style.css";
import BaseLayout from "../../layouts/BaseLayout.astro";
import ContentPost from "../../components/ContentPost.astro";
const allPosts = await Astro.glob(`../../data/articles/**/*.mdx`);
const localizedPost = allPosts.filter((post) => {
return post.frontmatter.lang === astroI18n.langCode;
});
const pageTitle = t("index.articles.pageName");
---
<BaseLayout pageTitle={pageTitle}>
<h2>{t("index.articles.pageName")}</h2>
<p>{t("index.articles.subtitle")}</p>
<ul>
{
localizedPost.map((post) => (
<li>
<a href={l(`/articles/${post.frontmatter.slug}`)}>
{post.frontmatter.title}
</a>
</li>
))
}
</ul>
</BaseLayout>