import type { Metadata, Viewport } from 'next'
import { Inter } from 'next/font/google'
import Script from 'next/script'
import './globals.css'
import { AuthProvider } from '@/components/AuthProvider'
import { UsageProvider } from '@/lib/contexts/UsageContext'
import { AnalyticsProvider } from '@/components/AnalyticsProvider'
import LayoutWrapper from './components/LayoutWrapper'
import { GTM_ID } from '@/lib/analytics'
const inter = Inter({
subsets: ['latin'],
display: 'swap',
preload: true
})
export const metadata: Metadata = {
title: {
default: 'AI-Powered Writing Platform for Authors',
template: '%s | Bookwiz.io',
},
description:
'Transform your writing with Bookwiz - the AI-powered platform that helps authors organize characters, plots, and world-building while providing intelligent writing assistance.',
authors: [{ name: 'Bookwiz Team' }],
creator: 'Bookwiz',
publisher: 'Bookwiz',
metadataBase: new URL('https://bookwiz.io'),
alternates: {
canonical: '/',
},
openGraph: {
type: 'website',
locale: 'en_US',
url: 'https://bookwiz.io',
title: 'AI-Powered Writing Platform for Authors',
description:
'Transform your writing with Bookwiz - the AI-powered platform that helps authors organize characters, plots, and world-building while providing intelligent writing assistance.',
siteName: 'Bookwiz',
images: [
{
url: 'https://bookwiz.io/og-image.png',
width: 1200,
height: 630,
alt: 'Bookwiz - AI-Powered Writing Platform',
},
],
},
twitter: {
card: 'summary_large_image',
title: 'AI-Powered Writing Platform for Authors',
description:
'Transform your writing with Bookwiz - the AI-powered platform that helps authors organize characters, plots, and world-building while providing intelligent writing assistance.',
images: ['https://bookwiz.io/og-image.png'],
creator: '@bookwiz_io',
},
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
'max-video-preview': -1,
'max-image-preview': 'large',
'max-snippet': -1,
},
},
icons: {
icon: [
{ url: '/favicon-16x16.png', sizes: '16x16', type: 'image/png' },
{ url: '/favicon-32x32.png', sizes: '32x32', type: 'image/png' },
{ url: '/favicon.ico', sizes: '32x32', type: 'image/x-icon' },
],
apple: [
{ url: '/favicon-180x180.png', sizes: '180x180', type: 'image/png' },
],
other: [
{ url: '/favicon-192x192.png', sizes: '192x192', type: 'image/png' },
{ url: '/favicon-512x512.png', sizes: '512x512', type: 'image/png' },
],
},
manifest: '/manifest.json',
appleWebApp: {
capable: true,
statusBarStyle: 'default',
title: 'Bookwiz.io',
},
verification: {
google: 'your-google-verification-code',
yandex: 'your-yandex-verification-code',
yahoo: 'your-yahoo-verification-code',
},
}
export const viewport: Viewport = {
width: 'device-width',
initialScale: 1,
maximumScale: 1,
userScalable: false,
themeColor: '#0F766E',
}
// Structured Data for SEO
const structuredData = {
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": "https://bookwiz.io/#organization",
"name": "Bookwiz",
"url": "https://bookwiz.io",
"logo": {
"@type": "ImageObject",
"url": "https://bookwiz.io/og-image.png",
"width": 1200,
"height": 630
},
"description": "AI-powered writing platform for authors",
"foundingDate": "2024",
"sameAs": [
"https://twitter.com/bookwiz_io"
]
},
{
"@type": "SoftwareApplication",
"@id": "https://bookwiz.io/#software",
"name": "Bookwiz.io",
"applicationCategory": "WritingApplication",
"operatingSystem": "Web",
"description": "Transform your writing with Bookwiz - the AI-powered platform that helps authors organize characters, plots, and world-building while providing intelligent writing assistance.",
"url": "https://bookwiz.io",
"installUrl": "https://bookwiz.io",
"downloadUrl": "https://bookwiz.io",
"screenshot": "https://bookwiz.io/og-image.png",
"offers": [
{
"@type": "Offer",
"name": "Free Plan",
"price": "0",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"description": "Create up to 3 books with basic AI features"
},
{
"@type": "Offer",
"name": "Explorer Plan",
"price": "9",
"priceCurrency": "USD",
"priceSpecification": {
"@type": "UnitPriceSpecification",
"price": "9",
"priceCurrency": "USD",
"billingDuration": "P1M"
},
"availability": "https://schema.org/InStock",
"description": "Unlimited projects with 100 🧠 Smart AI prompts"
},
{
"@type": "Offer",
"name": "Storyteller Plan",
"price": "35",
"priceCurrency": "USD",
"priceSpecification": {
"@type": "UnitPriceSpecification",
"price": "35",
"priceCurrency": "USD",
"billingDuration": "P1M"
},
"availability": "https://schema.org/InStock",
"description": "500 🧠 Smart AI prompts with priority support"
},
{
"@type": "Offer",
"name": "Professional Plan",
"price": "99",
"priceCurrency": "USD",
"priceSpecification": {
"@type": "UnitPriceSpecification",
"price": "99",
"priceCurrency": "USD",
"billingDuration": "P1M"
},
"availability": "https://schema.org/InStock",
"description": "2000 🧠 Smart AI prompts with team collaboration"
}
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"ratingCount": "320",
"bestRating": "5"
},
"publisher": {
"@id": "https://bookwiz.io/#organization"
}
},
{
"@type": "Product",
"@id": "https://bookwiz.io/#product",
"name": "Bookwiz.io - AI Writing Platform",
"description": "AI-powered writing platform that helps authors organize characters, plots, and world-building while providing intelligent writing assistance.",
"brand": {
"@id": "https://bookwiz.io/#organization"
},
"category": "Software",
"offers": {
"@type": "AggregateOffer",
"lowPrice": "0",
"highPrice": "99",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock",
"offerCount": "4"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"ratingCount": "320",
"bestRating": "5"
}
}
]
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang='en' suppressHydrationWarning>
<head>
{/* Font preconnections for performance */}
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
{/* Structured Data for SEO */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
/>
</head>
<body className={`${inter.className} min-h-screen flex flex-col`}>
{/* Google Tag Manager - Using Next.js Script for better security */}
<Script
id="gtm"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${GTM_ID}');
`,
}}
/>
{/* Dev Sender Email Click Tracking */}
<Script
src="https://dev-sender.vercel.app/devsender-tracking.js"
strategy="afterInteractive"
crossOrigin="anonymous"
defer
/>
{/* Google Tag Manager (noscript) - Added aria-label for accessibility */}
<noscript>
<iframe
src={`https://www.googletagmanager.com/ns.html?id=${GTM_ID}`}
height="0"
width="0"
style={{ display: 'none', visibility: 'hidden' }}
aria-label="Google Tag Manager"
/>
</noscript>
<AnalyticsProvider>
<AuthProvider>
<UsageProvider>
<LayoutWrapper>{children}</LayoutWrapper>
</UsageProvider>
</AuthProvider>
</AnalyticsProvider>
</body>
</html>
)
}