ergonomie
This commit is contained in:
25
src/pages/index.astro
Normal file
25
src/pages/index.astro
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import GameLayout from "../layouts/GameLayout.astro";
|
||||
import ContentSearch from "../components/ContentSearch.astro";
|
||||
|
||||
// 1. Récupère TOUS les articles et les trie.
|
||||
const allPosts = await getCollection("journal");
|
||||
const sortedPosts = allPosts.sort(
|
||||
(a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf(),
|
||||
);
|
||||
|
||||
// 2. Extrait toutes les balises uniques
|
||||
const allTags = [...new Set(allPosts.flatMap((post) => post.data.tags || []))];
|
||||
---
|
||||
|
||||
<GameLayout title="Journal d'Aventure">
|
||||
<h1>📖 Journal d'Aventure</h1>
|
||||
<p style="text-align: center; margin-bottom: 3rem;">
|
||||
Les chroniques de nos voyages. Utilisez la barre de recherche pour
|
||||
trouver un récit.
|
||||
</p>
|
||||
|
||||
<!-- 2. On passe tous les articles au composant client -->
|
||||
<ContentSearch posts={sortedPosts} tags={allTags} basePath="journal" />
|
||||
</GameLayout>
|
||||
Reference in New Issue
Block a user