---
import type { GetStaticPaths } from "astro";
import { Font } from "astro:assets";
import { getCollection, getEntry, render } from "astro:content";
import Layout from "@/layouts/Layout.astro";
import formatDate from "@/utils/formatDate";
import ChapterContent from "~/ChapterContent.astro";
export const getStaticPaths = (async () => {
const fics = await getCollection("fics");
return fics.map(fic => ({
params: { ficId: fic.id },
props: { fic },
}));
}) satisfies GetStaticPaths;
const { fic } = Astro.props;
const chapters = await getCollection("chapters", ({ id }) => {
return id.startsWith(fic.id);
});
chapters.length = Math.min(chapters.length, 5);
chapters.sort((a, b) => a.data.sortOrder - b.data.sortOrder);
const oneshot = chapters.length === 1 && await getEntry(chapters[0]);
const { Content } = oneshot && await render(oneshot);
---
{oneshot && (
)}
{fic.data.title}
- Fandom
{typeof fic.data.series === "object"
? (
{fic.data.series.map(fandom => (- {fandom}
))}
)
: (- {fic.data.series}
)
}
- Date
-
- Summary
-
{!oneshot && (
chapters
)}
{oneshot && (
)}