feat: initialize Prisma schema and scaffold core application modules including auth, blogs, events, and business directories
Some checks failed
Build and Push App / build (push) Failing after 47s
Some checks failed
Build and Push App / build (push) Failing after 47s
This commit is contained in:
@@ -4,15 +4,49 @@ import { notFound } from 'next/navigation';
|
||||
import { ArrowLeft, User, Calendar, Share2 } from 'lucide-react';
|
||||
import { prisma } from '../../../lib/prisma';
|
||||
|
||||
import { Metadata } from 'next';
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ id: string }>;
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
|
||||
const post = await prisma.blogPost.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
{ id: id },
|
||||
{ slug: id }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
if (!post) return { title: 'Article non trouvé' };
|
||||
|
||||
return {
|
||||
title: post.metaTitle || post.title,
|
||||
description: post.metaDescription || post.excerpt,
|
||||
keywords: post.tags,
|
||||
openGraph: {
|
||||
title: post.metaTitle || post.title,
|
||||
description: post.metaDescription || post.excerpt,
|
||||
images: [post.imageUrl],
|
||||
type: 'article',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default async function BlogPostPage({ params }: Props) {
|
||||
const { id } = await params;
|
||||
|
||||
const post = await prisma.blogPost.findUnique({
|
||||
where: { id }
|
||||
const post = await prisma.blogPost.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
{ id: id },
|
||||
{ slug: id }
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
if (!post) {
|
||||
@@ -49,9 +83,17 @@ export default async function BlogPostPage({ params }: Props) {
|
||||
<Calendar className="w-4 h-4 mr-1 text-brand-500" />
|
||||
{new Date(post.date).toLocaleDateString('fr-FR', { day: 'numeric', month: 'long', year: 'numeric' })}
|
||||
</span>
|
||||
<span className="px-2 py-1 bg-brand-50 text-brand-700 rounded text-xs font-semibold uppercase tracking-wide">
|
||||
Conseils
|
||||
</span>
|
||||
{post.tags.length > 0 ? (
|
||||
post.tags.map(tag => (
|
||||
<span key={tag} className="px-2 py-1 bg-brand-50 text-brand-700 rounded text-xs font-semibold uppercase tracking-wide">
|
||||
{tag}
|
||||
</span>
|
||||
))
|
||||
) : (
|
||||
<span className="px-2 py-1 bg-brand-50 text-brand-700 rounded text-xs font-semibold uppercase tracking-wide">
|
||||
Article
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<h1 className="text-3xl md:text-4xl font-serif font-bold text-gray-900 leading-tight">
|
||||
{post.title}
|
||||
|
||||
Reference in New Issue
Block a user