import { CtaBanner } from '@/app/(home)/_sections/cta-banner'; import { WindowImage } from '@/components/window-image'; import { type CompareData, getAllCompareSlugs, getCompareData, } from '@/lib/compare'; import { url } from '@/lib/layout.shared'; import { getOgImageUrl, getPageMetadata } from '@/lib/metadata'; import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import Script from 'next/script'; import { BenefitsSection } from './_components/benefits-section'; import { CompareFaq } from './_components/compare-faq'; import { CompareHero } from './_components/compare-hero'; import { CompareOverview } from './_components/compare-overview'; import { ComparisonTable } from './_components/comparison-table'; import { FeaturesShowcase } from './_components/features-showcase'; import { MigrationSection } from './_components/migration-section'; import { PricingSection } from './_components/pricing-section'; import { RelatedLinksSection } from './_components/related-links'; import { TechnicalComparison } from './_components/technical-comparison'; import { UseCases } from './_components/use-cases'; import { WhoShouldChoose } from './_components/who-should-choose'; export async function generateStaticParams() { const slugs = await getAllCompareSlugs(); return slugs.map((slug) => ({ slug })); } export async function generateMetadata({ params, }: { params: Promise<{ slug: string }>; }): Promise { const { slug } = await params; const data = await getCompareData(slug); if (!data) { return { title: 'Comparison Not Found', }; } return getPageMetadata({ title: data.seo.title, description: data.seo.description, url: data.url, image: getOgImageUrl(data.url), }); } export default async function ComparePage({ params, }: { params: Promise<{ slug: string }>; }) { const { slug } = await params; const data = await getCompareData(slug); if (!data) { return notFound(); } const pageUrl = url(`/compare/${slug}`); // Create JSON-LD schema const jsonLd = { '@context': 'https://schema.org', '@type': 'WebPage', name: data.seo.title, description: data.seo.description, url: pageUrl, publisher: { '@type': 'Organization', name: 'OpenPanel', logo: { '@type': 'ImageObject', url: url('/logo.webp'), }, }, }; // Build ToC items const tocItems = [ ...(data.overview ? [{ id: 'overview', label: data.overview.title }] : []), { id: 'who-should-choose', label: data.summary_comparison.title }, { id: 'comparison', label: data.highlights.title }, { id: 'features', label: data.feature_comparison.title }, ...(data.technical_comparison ? [{ id: 'technical', label: data.technical_comparison.title }] : []), { id: 'pricing', label: data.pricing.title }, ...(data.migration ? [{ id: 'migration', label: data.migration.title }] : []), { id: 'use-cases', label: data.use_cases.title }, ...(data.benefits_section ? [{ id: 'benefits', label: data.benefits_section.title }] : []), { id: 'faq', label: data.faqs.title }, ]; return (