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

45 lines
1.1 KiB
Plaintext

---
import { l, t, astroI18n } from "astro-i18n";
astroI18n.init(Astro);
// New astro content collections
import { getCollection } from "astro:content";
import BaseLayout from "../../layouts/BaseLayout.astro";
import ListCards from "../../components/ListCards.astro";
const localizedPost = await getCollection("references", ({ data }) => {
return data.lang === astroI18n.langCode && !data.draft;
});
// sort references by descending publication date
const sortedReferences = localizedPost.sort(
(a, b) => b.data.createdAt - a.data.createdAt
);
const pageTitle = t("index.references.pageName");
---
<BaseLayout pageTitle={pageTitle}>
<section class="region flow">
<h1>{t("index.references.pageName")}</h1>
<h2>{t("index.references.subtitle")}</h2>
<ListCards list={sortedReferences} routeName={t("references.slug")} />
</section>
</BaseLayout>
<style>
.flow h2 + :global(*) {
margin-block-start: var(--space-m-l);
}
h1 {
text-transform: capitalize;
}
h1,
h2 {
padding-inline-start: var(--space-xs-s);
}
h2 {
color: var(--color-brique);
}
</style>