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

32 lines
739 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";
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-22 11:01:52 +01:00
const allPosts = await Astro.glob(`../../data/articles/**/*.mdx`);
2022-12-05 20:50:35 +01:00
const localizedPost = allPosts.filter((post) => {
2022-12-22 11:01:52 +01:00
return post.frontmatter.lang === astroI18n.langCode;
2022-12-05 20:50:35 +01:00
});
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-22 11:01:52 +01:00
<h2>{t("index.articles.pageName")}</h2>
<p>{t("index.articles.subtitle")}</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>
2022-12-22 11:01:52 +01:00
<a href={l(`/articles/${post.frontmatter.slug}`)}>
{post.frontmatter.title}
</a>
2022-12-02 11:21:18 +01:00
</li>
))
}
</ul>
</BaseLayout>