Files
webb/src/app/layout.tsx
T

212 lines
7.9 KiB
TypeScript
Raw Normal View History

import type { Metadata } from 'next';
import './globals.css';
import { getSiteConfig, getAllCategories, getAllTools } from '@/lib/config/loader';
import { Navbar } from '@/components/ui/Navbar';
import { Footer } from '@/components/ui/Footer';
import { SmoothScrollProvider } from '@/components/ui/SmoothScrollProvider';
export async function generateMetadata(): Promise<Metadata> {
const config = getSiteConfig();
const siteUrl = (process.env.SITE_URL || config.seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
return {
title: {
default: `CRE Innovations | Free AI Photo Editor - Background Remover, Face Retouch & More`,
template: config.seo.titleTemplate || `%s | CRE Innovations`,
},
description: 'Free online AI photo editing tools: remove backgrounds instantly, retouch portraits, restore old photos, whiten teeth, swap faces & apply 200+ creative filters. No signup, no watermark.',
metadataBase: new URL(siteUrl),
keywords: [
'free AI photo editor online',
'background remover',
'AI portrait retouching',
'face retouch online free',
'old photo restoration',
'teeth whitener AI',
'AI face swap',
'anime avatar maker',
'photo enhancer 4K',
'remove background from photo',
'CRE Innovations',
'AI photo tools',
],
authors: [{ name: 'CRE Innovations', url: siteUrl }],
creator: 'CRE Innovations',
publisher: 'CRE Innovations',
applicationName: 'CRE Innovations Studio',
generator: 'Next.js',
referrer: 'origin-when-cross-origin',
alternates: {
canonical: siteUrl,
},
openGraph: {
type: 'website',
siteName: 'CRE Innovations',
title: `CRE Innovations | Free AI Photo Editor & Creative Tools`,
description: 'Remove backgrounds, retouch portraits, restore old photos & apply 200+ AI effects. Free online, no signup required.',
url: siteUrl,
locale: config.seo.locale || 'en_US',
images: [{ url: `${siteUrl}/brand/og-default.png`, width: 1200, height: 630, alt: 'CRE Innovations - Free AI Photo Editing Tools' }],
},
twitter: {
card: 'summary_large_image',
site: config.seo.twitterHandle || '@CREInnovations',
creator: config.seo.twitterHandle || '@CREInnovations',
title: `CRE Innovations | Free AI Photo Editor & Creative Tools`,
description: 'Remove backgrounds, retouch portraits, restore old photos & apply 200+ AI effects. Free, no signup.',
images: [`${siteUrl}/brand/og-default.png`],
},
robots: {
index: true,
follow: true,
nocache: false,
googleBot: {
index: true,
follow: true,
'max-video-preview': -1,
'max-image-preview': 'large',
'max-snippet': -1,
},
},
manifest: '/manifest.webmanifest',
icons: {
icon: [
{ url: '/favicon.ico', sizes: 'any' },
{ url: '/brand/icon.svg', type: 'image/svg+xml' },
],
apple: '/brand/icon.svg',
},
appleWebApp: {
capable: true,
statusBarStyle: 'black-translucent',
title: 'CRE Innovations',
},
category: 'technology',
};
}
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
const config = getSiteConfig();
const categories = getAllCategories();
const tools = getAllTools();
const siteUrl = (process.env.SITE_URL || config.seo.siteUrl || 'http://localhost:3000').replace(/\/$/, '');
// Root Schema.org JSON-LD for Organization & WebSite
const organizationJsonLd = {
'@context': 'https://schema.org',
'@graph': [
{
'@type': 'Organization',
'@id': `${siteUrl}/#organization`,
name: 'CRE Innovations',
url: siteUrl,
logo: {
'@type': 'ImageObject',
url: `${siteUrl}/brand/logo.svg`,
width: 200,
height: 60,
},
description: config.organization?.description || 'CRE Innovations builds free AI-powered photo editing tools: background removal, portrait retouching, photo restoration, and 200+ creative filters.',
foundingDate: config.organization?.foundingDate || '2021',
...(config.organization?.storeUrls ? {
sameAs: [
config.organization.storeUrls.android,
config.organization.storeUrls.ios,
].filter(Boolean),
} : {
sameAs: [
'https://play.google.com/store/apps/developer?id=CRE+Innovations',
'https://apps.apple.com/developer/cre-innovations',
],
}),
contactPoint: {
'@type': 'ContactPoint',
contactType: 'customer support',
availableLanguage: config.organization?.contactLanguages || ['English', 'Hindi'],
},
},
{
'@type': 'WebSite',
'@id': `${siteUrl}/#website`,
url: siteUrl,
name: 'CRE Innovations',
description: 'Free AI photo editing tools — no signup, no watermark.',
publisher: { '@id': `${siteUrl}/#organization` },
potentialAction: {
'@type': 'SearchAction',
target: { '@type': 'EntryPoint', urlTemplate: `${siteUrl}/tools?q={search_term_string}` },
'query-input': 'required name=search_term_string',
},
inLanguage: 'en-US',
},
],
};
return (
<html lang="en" className="font-sans">
<head>
<meta httpEquiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta httpEquiv="Pragma" content="no-cache" />
<meta httpEquiv="Expires" content="0" />
<script
dangerouslySetInnerHTML={{
__html: `
(function() {
try {
// 1. Unregister any stale Service Workers on client devices
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for (var i = 0; i < registrations.length; i++) {
registrations[i].unregister();
}
});
}
// 2. Clear stale Cache Storage API entries
if ('caches' in window) {
caches.keys().then(function(keys) {
for (var i = 0; i < keys.length; i++) {
caches.delete(keys[i]);
}
});
}
// 3. Automated cache-bust verification
var BUILD_TAG = '20261117_sfpro_v2';
var cachedTag = localStorage.getItem('__cre_build_tag');
if (cachedTag !== BUILD_TAG) {
localStorage.setItem('__cre_build_tag', BUILD_TAG);
if (cachedTag !== null && window.location.search.indexOf('v=') === -1) {
// Perform clean cache-busting reload once for returning visitors
window.location.replace(window.location.pathname + (window.location.search ? window.location.search + '&' : '?') + 'v=' + Date.now());
}
}
} catch(e) {}
})();
`,
}}
/>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(organizationJsonLd) }}
/>
</head>
2026-11-06 10:53:55 +05:30
<body className="min-h-screen flex flex-col antialiased bg-paper text-ink relative font-sans overflow-x-clip">
<SmoothScrollProvider>
<a href="#main-content" className="skip-link">Skip to main content</a>
<Navbar
config={config}
currentLocale="en"
categories={categories}
tools={tools}
totalToolsCount={tools.length}
/>
<main id="main-content" className="flex-1">{children}</main>
<Footer config={config} currentLocale="en" />
</SmoothScrollProvider>
</body>
</html>
);
}