clone init
This commit is contained in:
36
app/[locale]/[slug]/page.tsx
Normal file
36
app/[locale]/[slug]/page.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { MDXRemote } from 'next-mdx-remote/rsc';
|
||||
import { getPostBySlug } from '@/lib/blog';
|
||||
|
||||
interface PageProps {
|
||||
params: {
|
||||
locale: string;
|
||||
slug: string;
|
||||
};
|
||||
}
|
||||
|
||||
export default async function StandardPage({ params: { locale, slug } }: PageProps) {
|
||||
const page = await getPostBySlug(slug, locale); // Reusing blog logic for now as structure is same
|
||||
|
||||
// If not found in blog, try pages directory (we need to implement getPageBySlug)
|
||||
// Actually, let's implement getPageBySlug in lib/mdx.ts or similar
|
||||
|
||||
// For now, let's assume we use a unified loader or separate.
|
||||
// Let's use a separate loader for pages.
|
||||
|
||||
const { getPageBySlug } = await import('@/lib/pages');
|
||||
const pageData = await getPageBySlug(slug, locale);
|
||||
|
||||
if (!pageData) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container mx-auto px-4 py-12 max-w-4xl">
|
||||
<h1 className="text-4xl font-bold text-primary mb-8">{pageData.frontmatter.title}</h1>
|
||||
<div className="prose prose-lg max-w-none">
|
||||
<MDXRemote source={pageData.content} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user