--- import { Icon } from "astro-icon/components"; import { type CollectionEntry, getCollection } from "astro:content"; type Props = { entry: CollectionEntry<"posts"> | CollectionEntry<"projects">; }; const { entry } = Astro.props; const { collection } = entry; const items = (await getCollection(collection)) .filter((post) => !post.data.draft) .sort((a, b) => b.data.date.getTime() - a.data.date.getTime()); const index = items.findIndex((x) => x.slug === entry.slug); const prev = items[(index - 1 + items.length) % items.length]; const next = items[(index + 1) % items.length]; ---

{prev.data.title}

{next.data.title}