Maj taxonomies
Some checks failed
Build and Push App / build (push) Failing after 11m28s

maj url photo
+ page 404
+ gestion programmation d'article
This commit is contained in:
2026-05-03 21:22:12 +02:00
parent 0e72867d4c
commit 5f421b418e
41 changed files with 1946 additions and 735 deletions

View File

@@ -14,16 +14,21 @@ interface Props {
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { id } = await params;
const now = new Date();
const interview = await prisma.interview.findFirst({
where: {
OR: [{ id }, { slug: id }]
OR: [{ id }, { slug: id }],
publishedAt: { lte: now },
status: 'PUBLISHED'
}
});
const event = !interview ? await prisma.event.findFirst({
where: {
OR: [{ id }, { slug: id }]
OR: [{ id }, { slug: id }],
publishedAt: { lte: now },
status: 'PUBLISHED'
}
}) : null;
@@ -47,18 +52,23 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
export default async function AfroLifeDetailPage({ params }: Props) {
const { id } = await params;
const now = new Date();
// 1. Try to find an interview
const interview = await prisma.interview.findFirst({
where: {
OR: [{ id }, { slug: id }]
OR: [{ id }, { slug: id }],
publishedAt: { lte: now },
status: 'PUBLISHED'
}
});
// 2. If not found, try to find an event
const event = !interview ? await prisma.event.findFirst({
where: {
OR: [{ id }, { slug: id }]
OR: [{ id }, { slug: id }],
publishedAt: { lte: now },
status: 'PUBLISHED'
}
}) : null;
@@ -157,7 +167,7 @@ export default async function AfroLifeDetailPage({ params }: Props) {
)}
{/* Description / Article Content / Event Content */}
<div className="prose prose-lg prose-orange max-w-none mx-auto text-gray-600 break-words overflow-hidden">
<div className="prose prose-lg prose-orange max-w-none mx-auto text-gray-600">
{isEvent ? (
<div dangerouslySetInnerHTML={{ __html: sanitizeHTML((event as any).description) }} />
) : (
@@ -195,4 +205,3 @@ export default async function AfroLifeDetailPage({ params }: Props) {
</div>
);
}