Files
site-portfolio/src/pages/projets/index.astro
T

27 lines
766 B
Plaintext

---
import { getCollection } from 'astro:content';
import Base from '../../layouts/Base.astro';
const projets = (await getCollection('projets', ({ data }) => !data.brouillon)).sort(
(a, b) => b.data.date.valueOf() - a.data.date.valueOf(),
);
const sections = [
{ titre: 'Réalisations', items: projets.filter((p) => p.data.categorie === 'client') },
{ titre: 'Atelier', items: projets.filter((p) => p.data.categorie === 'atelier') },
];
---
<Base title="Projets">
<h1>Projets</h1>
{sections.map(({ titre, items }) => items.length > 0 && (
<section>
<h2>{titre}</h2>
<ul>
{items.map((p) => (
<li><a href={`/projets/${p.id}/`}>{p.data.titre}</a> : {p.data.resume}</li>
))}
</ul>
</section>
))}
</Base>