maj url photo + page 404 + gestion programmation d'article
This commit is contained in:
@@ -62,6 +62,10 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
|
||||
// 3. Fetch all blog posts
|
||||
const blogPosts = await prisma.blogPost.findMany({
|
||||
where: {
|
||||
status: 'PUBLISHED',
|
||||
publishedAt: { lte: new Date() }
|
||||
},
|
||||
select: { id: true, slug: true, updatedAt: true },
|
||||
});
|
||||
|
||||
@@ -74,6 +78,10 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
|
||||
// 4. Fetch all Afro Life (Interviews)
|
||||
const interviews = await prisma.interview.findMany({
|
||||
where: {
|
||||
status: 'PUBLISHED',
|
||||
publishedAt: { lte: new Date() }
|
||||
},
|
||||
select: { id: true, slug: true, updatedAt: true },
|
||||
});
|
||||
|
||||
@@ -84,7 +92,23 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
priority: 0.7,
|
||||
}));
|
||||
|
||||
return [...staticRoutes, ...businessRoutes, ...blogRoutes, ...afroLifeRoutes];
|
||||
// 5. Fetch all Events
|
||||
const events = await prisma.event.findMany({
|
||||
where: {
|
||||
status: 'PUBLISHED',
|
||||
publishedAt: { lte: new Date() }
|
||||
},
|
||||
select: { id: true, slug: true, updatedAt: true },
|
||||
});
|
||||
|
||||
const eventRoutes = events.map((event) => ({
|
||||
url: `${baseUrl}/afrolife/${event.slug || event.id}`,
|
||||
lastModified: event.updatedAt,
|
||||
changeFrequency: 'monthly' as const,
|
||||
priority: 0.7,
|
||||
}));
|
||||
|
||||
return [...staticRoutes, ...businessRoutes, ...blogRoutes, ...afroLifeRoutes, ...eventRoutes];
|
||||
} catch (error) {
|
||||
console.error("Error generating sitemap:", error);
|
||||
// Fallback to only static routes if DB connection fails
|
||||
|
||||
Reference in New Issue
Block a user