fix: apply seo agent improvements to src/app/layout.tsx

This commit is contained in:
cupadev-admin 2026-03-09 19:00:49 +00:00
parent 64d1d67eb6
commit 1d320972c7
1 changed files with 92 additions and 17 deletions

View File

@ -1,10 +1,90 @@
import type { Metadata } from 'next'
import type { Metadata, Viewport } from 'next'
import './globals.css'
import { Toaster } from 'react-hot-toast'
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || 'https://example.com'
const SITE_NAME = process.env.NEXT_PUBLIC_SITE_NAME || 'My Personal Site'
const SITE_DESCRIPTION =
process.env.NEXT_PUBLIC_SITE_DESCRIPTION ||
'Personal website and blog — articles, projects, and more.'
export const metadata: Metadata = {
title: 'Association des Anciens Combattants',
description: 'Site officiel de l\'association des anciens combattants français',
metadataBase: new URL(SITE_URL),
title: {
default: SITE_NAME,
template: `%s | ${SITE_NAME}`,
},
description: SITE_DESCRIPTION,
applicationName: SITE_NAME,
referrer: 'origin-when-cross-origin',
keywords: ['blog', 'personal site', 'articles', 'portfolio'],
authors: [{ name: SITE_NAME, url: SITE_URL }],
creator: SITE_NAME,
publisher: SITE_NAME,
formatDetection: {
email: false,
address: false,
telephone: false,
},
alternates: {
canonical: '/',
},
openGraph: {
type: 'website',
locale: 'en_US',
url: SITE_URL,
siteName: SITE_NAME,
title: SITE_NAME,
description: SITE_DESCRIPTION,
images: [
{
url: '/og-default.png',
width: 1200,
height: 630,
alt: `${SITE_NAME} — Open Graph Image`,
},
],
},
twitter: {
card: 'summary_large_image',
title: SITE_NAME,
description: SITE_DESCRIPTION,
images: ['/og-default.png'],
creator: process.env.NEXT_PUBLIC_TWITTER_HANDLE || '',
site: process.env.NEXT_PUBLIC_TWITTER_HANDLE || '',
},
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.ico', sizes: 'any' },
{ url: '/icon.svg', type: 'image/svg+xml' },
],
apple: [{ url: '/apple-touch-icon.png', sizes: '180x180' }],
shortcut: '/favicon-32x32.png',
},
manifest: '/site.webmanifest',
verification: {
google: process.env.NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION || '',
},
}
export const viewport: Viewport = {
themeColor: [
{ media: '(prefers-color-scheme: light)', color: '#ffffff' },
{ media: '(prefers-color-scheme: dark)', color: '#0f172a' },
],
width: 'device-width',
initialScale: 1,
maximumScale: 5,
}
export default function RootLayout({
@ -13,22 +93,17 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<html lang="fr">
<html lang="en" dir="ltr">
<body>
<a href="#main-content" className="skip-link">
Aller au contenu principal
{/* Accessibility: skip to main content */}
<a
href="#main-content"
className="skip-link"
aria-label="Skip to main content"
>
Skip to main content
</a>
{children}
<Toaster
position="top-right"
toastOptions={{
style: {
background: '#002395',
color: '#fff',
borderLeft: '4px solid #C9A84C',
},
}}
/>
</body>
</html>
)