SEO
This commit is contained in:
@@ -3,7 +3,7 @@ import { cookies } from 'next/headers'
|
||||
import { headers } from 'next/headers'
|
||||
import './globals.css'
|
||||
import { LangProvider } from '@/context/LangContext'
|
||||
import { siteConfig, hasIosStoreUrl } from '@/lib/site'
|
||||
import { siteConfig, hasIosStoreUrl, hasAndroidStoreUrl } from '@/lib/site'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
metadataBase: new URL(siteConfig.domain),
|
||||
@@ -54,6 +54,20 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
const lang = (routeLang ?? cookieStore.get('lang')?.value ?? 'de') as 'de' | 'en' | 'es'
|
||||
const validLangs = ['de', 'en', 'es']
|
||||
const htmlLang = validLangs.includes(lang) ? lang : 'de'
|
||||
const schemaDescription = {
|
||||
de: 'Pflanzen per Foto einordnen, Pflegepläne nutzen und sichtbare Pflanzenprobleme prüfen.',
|
||||
en: 'Assess plants from photos, use care plans, and review visible plant problems.',
|
||||
es: 'Evalúa plantas con fotos, utiliza planes de cuidado y revisa problemas visibles.',
|
||||
}[htmlLang]
|
||||
const organizationDescription = {
|
||||
de: 'GreenLens ist eine App zur Pflanzenerkennung und Pflegeplanung.',
|
||||
en: 'GreenLens is an app for plant identification and care planning.',
|
||||
es: 'GreenLens es una app para identificar plantas y planificar sus cuidados.',
|
||||
}[htmlLang]
|
||||
const operatingSystems = [
|
||||
hasIosStoreUrl ? 'iOS' : null,
|
||||
hasAndroidStoreUrl ? 'Android' : null,
|
||||
].filter((value): value is string => Boolean(value))
|
||||
|
||||
return (
|
||||
<html lang={htmlLang}>
|
||||
@@ -76,11 +90,10 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'SoftwareApplication',
|
||||
name: siteConfig.name,
|
||||
operatingSystem: 'iOS, Android',
|
||||
...(operatingSystems.length > 0 && { operatingSystem: operatingSystems.join(', ') }),
|
||||
applicationCategory: 'LifestyleApplication',
|
||||
description:
|
||||
'Pflanzen per Foto erkennen, Pflegepläne nutzen und Pflanzenprobleme einordnen.',
|
||||
inLanguage: ['en', 'de', 'es'],
|
||||
description: schemaDescription,
|
||||
inLanguage: htmlLang,
|
||||
...(hasIosStoreUrl && { downloadUrl: siteConfig.iosAppStoreUrl }),
|
||||
offers: {
|
||||
'@type': 'Offer',
|
||||
@@ -93,8 +106,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
'@type': 'Organization',
|
||||
name: siteConfig.name,
|
||||
url: siteConfig.domain,
|
||||
description:
|
||||
'GreenLens ist eine App zur Pflanzenerkennung und Pflegeplanung für iOS und Android.',
|
||||
description: organizationDescription,
|
||||
contactPoint: {
|
||||
'@type': 'ContactPoint',
|
||||
contactType: 'customer support',
|
||||
@@ -109,7 +121,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<LangProvider>{children}</LangProvider>
|
||||
<LangProvider initialLang={htmlLang}>{children}</LangProvider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user