29 lines
714 B
TypeScript
29 lines
714 B
TypeScript
import type { MetadataRoute } from "next";
|
|
import { prisma } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
const manga = await prisma.manga.findMany({
|
|
where: { status: "PUBLISHED" },
|
|
select: { slug: true, updatedAt: true },
|
|
});
|
|
|
|
const mangaEntries: MetadataRoute.Sitemap = manga.map((m) => ({
|
|
url: `https://manga.04080616.xyz/manga/${m.slug}`,
|
|
lastModified: m.updatedAt,
|
|
changeFrequency: "weekly",
|
|
priority: 0.8,
|
|
}));
|
|
|
|
return [
|
|
{
|
|
url: "https://manga.04080616.xyz",
|
|
lastModified: new Date(),
|
|
changeFrequency: "daily",
|
|
priority: 1,
|
|
},
|
|
...mangaEntries,
|
|
];
|
|
}
|