For example, I have a file called [...tags].astro. And this is the exported getStaticPaths.
export async function getStaticPaths() {
const postEntries = await getCollection("posts");
const tagSet = new Set<string>();
postEntries.forEach((entry) => {
entry.data.tags.forEach((tag) => {
tagSet.add(tag);
});
});
const tags = Array.from(tagSet).sort();
return tags.map((tag) => ({
params: { tag },
props: {
tag,
postEntries: postEntries
.filter((entry) => entry.data.tags.includes(tag))
.sort((a, b) => b.data.datetime.getTime() - a.data.datetime.getTime()),
},
}));
}
What do I have to do to have it also handle the index page (when there's only a /)?