115 lines
3.7 KiB
TypeScript
115 lines
3.7 KiB
TypeScript
import type { Metadata } from 'next'
|
||
import { cookies } from 'next/headers'
|
||
import './globals.css'
|
||
import { LangProvider } from '@/context/LangContext'
|
||
import { siteConfig, hasIosStoreUrl } from '@/lib/site'
|
||
|
||
export const metadata: Metadata = {
|
||
metadataBase: new URL(siteConfig.domain),
|
||
title: {
|
||
default: 'GreenLens - Plant Identifier and Care Planner',
|
||
template: '%s | GreenLens',
|
||
},
|
||
description:
|
||
'GreenLens helps you identify plants, organize your collection, and keep up with care routines in one app.',
|
||
keywords: [
|
||
'plant identifier by picture',
|
||
'plant care app',
|
||
'watering reminders',
|
||
'houseplant tracker',
|
||
'plant identification',
|
||
'plant health check',
|
||
'Pflanzen App',
|
||
'GreenLens',
|
||
],
|
||
authors: [{ name: siteConfig.name }],
|
||
openGraph: {
|
||
title: 'GreenLens - Plant Identifier and Care Planner',
|
||
description: 'Identify plants, get care guidance, and manage your collection with GreenLens.',
|
||
type: 'website',
|
||
url: siteConfig.domain,
|
||
images: [
|
||
{
|
||
url: '/og-image.png',
|
||
width: 1200,
|
||
height: 630,
|
||
alt: 'GreenLens – Plant Identifier and Care Planner',
|
||
},
|
||
],
|
||
},
|
||
twitter: {
|
||
card: 'summary_large_image',
|
||
title: 'GreenLens - Plant Identifier and Care Planner',
|
||
description: 'Identify plants, get care guidance, and manage your collection with GreenLens.',
|
||
images: ['/og-image.png'],
|
||
},
|
||
alternates: {
|
||
canonical: '/',
|
||
languages: {
|
||
de: '/',
|
||
en: '/',
|
||
es: '/',
|
||
'x-default': '/',
|
||
},
|
||
},
|
||
}
|
||
|
||
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||
const cookieStore = await cookies()
|
||
const lang = (cookieStore.get('lang')?.value ?? 'de') as 'de' | 'en' | 'es'
|
||
const validLangs = ['de', 'en', 'es']
|
||
const htmlLang = validLangs.includes(lang) ? lang : 'de'
|
||
|
||
return (
|
||
<html lang={htmlLang}>
|
||
<head>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||
<script
|
||
type="application/ld+json"
|
||
dangerouslySetInnerHTML={{
|
||
__html: JSON.stringify([
|
||
{
|
||
'@context': 'https://schema.org',
|
||
'@type': 'SoftwareApplication',
|
||
name: siteConfig.name,
|
||
operatingSystem: 'iOS, Android',
|
||
applicationCategory: 'LifestyleApplication',
|
||
description:
|
||
'Identify plants, track care schedules, and manage your collection with AI-powered scans.',
|
||
inLanguage: ['de', 'en', 'es'],
|
||
...(hasIosStoreUrl && { downloadUrl: siteConfig.iosAppStoreUrl }),
|
||
offers: {
|
||
'@type': 'Offer',
|
||
price: '0',
|
||
priceCurrency: 'EUR',
|
||
},
|
||
},
|
||
{
|
||
'@context': 'https://schema.org',
|
||
'@type': 'Organization',
|
||
name: siteConfig.name,
|
||
url: siteConfig.domain,
|
||
description:
|
||
'GreenLens is a plant identification and care planning app for iOS and Android.',
|
||
contactPoint: {
|
||
'@type': 'ContactPoint',
|
||
contactType: 'customer support',
|
||
email: siteConfig.supportEmail,
|
||
},
|
||
...(hasIosStoreUrl && {
|
||
sameAs: [siteConfig.iosAppStoreUrl],
|
||
}),
|
||
},
|
||
]),
|
||
}}
|
||
/>
|
||
</head>
|
||
<body>
|
||
<LangProvider>{children}</LangProvider>
|
||
</body>
|
||
</html>
|
||
)
|
||
}
|