import { Metadata } from "next"; interface SEOParams { title?: string; description?: string; path?: string; image?: string; noIndex?: boolean; canonical?: string; } export function generateSEO({ title = "OmniDev | AI Project Builder", description = "OmniDev is an AI engineering environment that builds complete web projects (frontend + backend) from natural language.", path = "", image = "/banner.png", noIndex = false, canonical, }: SEOParams = {}): Metadata { const baseUrl = process.env.PUBLIC_BASE_URL || "https://omnidev.hf.co"; const fullUrl = `${baseUrl}${path}`; const canonicalUrl = canonical || fullUrl; return { title, description, alternates: { canonical: canonicalUrl, }, robots: noIndex ? { index: false, follow: false, googleBot: { index: false, follow: false, 'max-video-preview': -1, 'max-image-preview': 'large', 'max-snippet': -1, } } : { index: true, follow: true, googleBot: { index: true, follow: true, 'max-video-preview': -1, 'max-image-preview': 'large', 'max-snippet': -1, } }, openGraph: { title, description, url: canonicalUrl, siteName: "OmniDev", images: [ { url: `${baseUrl}${image}`, width: 1200, height: 630, alt: `${title} - OmniDev`, }, ], locale: "en_US", type: "website", }, twitter: { card: "summary_large_image", title, description, images: [`${baseUrl}${image}`], creator: "@omnidev", }, other: { 'X-Frame-Options': 'SAMEORIGIN', 'og:image:secure_url': `${baseUrl}${image}`, 'rel': 'canonical', }, }; } export function generateStructuredData(type: 'WebApplication' | 'Organization' | 'Article', data: any) { const baseStructuredData = { '@context': 'https://schema.org', '@type': type, }; switch (type) { case 'WebApplication': return { ...baseStructuredData, name: 'OmniDev', description: 'AI-powered full-stack project builder', url: process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co', applicationCategory: 'DeveloperApplication', operatingSystem: 'Web', offers: { '@type': 'Offer', price: '0', priceCurrency: 'USD', }, creator: { '@type': 'Organization', name: 'OmniDev', url: process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co', }, ...data, }; case 'Organization': return { ...baseStructuredData, name: 'OmniDev', url: process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co', logo: `${process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co'}/logo.svg`, description: 'AI-powered web development platform', sameAs: [ ], ...data, }; default: return { ...baseStructuredData, ...data }; } }