refactor(site): remplace le blog par une collection projets
This commit is contained in:
1 parent
b98c5ed6c7
commit
72c1809485
23 files changed
+152
-700
No files matched your search
@@ -0,0 +1,26 @@
|
||||
---
|
||||
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>
|
||||
Reference in new issue
Block a user