---
import { getCollection } from "astro:content";
import GameLayout from "../layouts/GameLayout.astro";
import Timeline from "../components/Timeline.astro";
import ContentSearch from "../components/ContentSearch.astro";
const allPosts = await getCollection("journal");
// On récupère les Ères
const eras = allPosts
.filter((p) => p.data.isEra)
.sort((a, b) => a.data.publishDate.valueOf() - b.data.publishDate.valueOf())
.map((p) => ({ id: p.id, title: p.data.title }));
const chroniclesOnly = allPosts.filter((post) => !post.data.isEra);
const sortedPosts = chroniclesOnly.sort(
(a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf(),
);
const allTags = [
...new Set(chroniclesOnly.flatMap((post) => post.data.tags || [])),
];
---