import { notFound } from 'next/navigation'; import { ContentRenderer } from '@/components/content/ContentRenderer'; import { FeaturedImage } from '@/components/content/FeaturedImage'; import { ResponsiveWrapper, ResponsiveSection } from '@/components/layout/ResponsiveWrapper'; import { LocaleSwitcher } from '@/components/LocaleSwitcher'; import { SEO } from '@/components/SEO'; import { Container } from '@/components/ui/Container'; import { getAllPages, getMediaById, getPageBySlug } from '@/lib/data'; import { Metadata } from 'next'; interface PageProps { params: { locale: string; slug?: string; }; } export async function generateStaticParams() { const pages = await getAllPages(); const params = pages.map((page) => ({ locale: page.locale, slug: page.slug, })); return params; } export async function generateMetadata({ params }: PageProps): Promise { const { locale, slug = 'home' } = params; // Map root path to actual home page slugs const homeSlugs: Record = { 'en': 'corporate-3-landing-2', 'de': 'start' }; const actualSlug = slug === 'home' ? homeSlugs[locale] || 'home' : slug; const page = await getPageBySlug(actualSlug, locale); if (!page) { return { title: 'Page Not Found', }; } return { title: page.title, description: page.excerptHtml || '', alternates: { languages: { de: slug === 'home' ? '/de' : `/de/${slug}`, en: slug === 'home' ? '/en' : `/en/${slug}`, }, }, }; } export default async function Page({ params }: PageProps) { const { locale, slug = 'home' } = params; // Map root path to actual home page slugs const homeSlugs: Record = { 'en': 'corporate-3-landing-2', 'de': 'start' }; const actualSlug = slug === 'home' ? homeSlugs[locale] || 'home' : slug; const page = await getPageBySlug(actualSlug, locale); if (!page) { notFound(); } // Special handling for home page vs other pages const isHomePage = slug === 'home' || actualSlug === 'corporate-3-landing-2' || actualSlug === 'start'; if (isHomePage) { // HOME PAGE: Render content directly without additional wrappers // The content already contains full vc_row structures with backgrounds return ( <> {/* Main content - full width, no containers */}
{/* Locale switcher at bottom */} ); } // STANDARD PAGES: Use the existing layout with hero and containers const contentToDisplay = page.contentHtml || page.excerptHtml; const featuredImage = page.featuredImage ? getMediaById(page.featuredImage) : null; return ( <> {/* Hero Section with Featured Image */} {featuredImage && (

{page.title}

)} {/* Main Content */} {/* Title - only show if no featured image */} {!featuredImage && (

{page.title}

)} {/* Content with pattern parsing */} {contentToDisplay && ( )}
{/* Locale Switcher */} ); }