import { getPageConfig, getAllTools, getAllApps, getAllCategories, getToolById, getAppById, getSiteConfig } from '@/lib/config/loader'; import { getEndpointById } from '@/lib/catalog/loader'; import { SectionRenderer } from '@/components/sections/SectionRenderer'; import { notFound } from 'next/navigation'; export const revalidate = 600; // ISR 10 minutes fallback per PRD §4.2 export default function HomePage() { const page = getPageConfig('home'); if (!page) notFound(); const tools = getAllTools(); const apps = getAllApps(); const categories = getAllCategories(); const siteUrl = (process.env.SITE_URL || getSiteConfig().seo.siteUrl || 'http://localhost:3000').replace(/\/$/, ''); // Find hero tool and variants const heroTool = getToolById('face.blemish.remove') || tools[0]; const heroApp = heroTool ? getAppById(heroTool.homeApp) : null; const endpoint = heroTool?.tryIt?.endpointRef?.id ? getEndpointById(heroTool.tryIt.endpointRef.id) : undefined; const variants = endpoint?.variants || []; const context = { page, tools, apps, categories, tool: heroTool, homeApp: heroApp, variants, locale: 'en', }; // Structured Data (JSON-LD) for WebSite and FAQPage (PRD §10 SEO-07) const faqSection = page.sections.find((s) => s.type === 'faq'); const faqItems = faqSection?.props?.items || []; const jsonLdData = [ { '@context': 'https://schema.org', '@type': 'WebSite', name: 'CRE Innovations', url: siteUrl, potentialAction: { '@type': 'SearchAction', target: `${siteUrl}/tools?q={search_term_string}`, 'query-input': 'required name=search_term_string', }, }, { '@context': 'https://schema.org', '@type': 'FAQPage', mainEntity: faqItems.map((item: any) => ({ '@type': 'Question', name: item.q, acceptedAnswer: { '@type': 'Answer', text: item.a, }, })), }, ]; return (