fix: apply seo agent improvements to src/app/blog/layout.tsx
This commit is contained in:
parent
15b3869a91
commit
b786fb6cd2
|
|
@ -2,13 +2,54 @@ import type { Metadata } from 'next'
|
|||
|
||||
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 BLOG_DESCRIPTION =
|
||||
'Articles, thoughts, and tutorials from ' + SITE_NAME + '.'
|
||||
|
||||
// ─── Blog section metadata (overrides root defaults) ─────────────────────────
|
||||
export const metadata: Metadata = {
|
||||
title: 'Blog',
|
||||
description: BLOG_DESCRIPTION,
|
||||
alternates: {
|
||||
canonical: `${SITE_URL}/blog`,
|
||||
types: {
|
||||
'application/rss+xml': `${SITE_URL}/feed.xml`,
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
url: `${SITE_URL}/blog`,
|
||||
title: `Blog | ${SITE_NAME}`,
|
||||
description: BLOG_DESCRIPTION,
|
||||
images: [
|
||||
{
|
||||
url: `/og-blog.png`,
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: `${SITE_NAME} Blog`,
|
||||
},
|
||||
],
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title: `Blog | ${SITE_NAME}`,
|
||||
description: BLOG_DESCRIPTION,
|
||||
images: [`/og-blog.png`],
|
||||
},
|
||||
}
|
||||
|
||||
// ─── Blog section JSON-LD ────────────────────────────────────────────────────
|
||||
const blogJsonLd = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Blog',
|
||||
name: `${SITE_NAME} — Blog`,
|
||||
url: `${SITE_URL}/blog`,
|
||||
description: BLOG_DESCRIPTION,
|
||||
inLanguage: 'en-US',
|
||||
publisher: {
|
||||
'@type': 'Person',
|
||||
name: SITE_NAME,
|
||||
url: SITE_URL,
|
||||
},
|
||||
}
|
||||
|
||||
export default function BlogLayout({
|
||||
|
|
@ -16,24 +57,11 @@ export default function BlogLayout({
|
|||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const blogListingJsonLd = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Blog',
|
||||
name: `${SITE_NAME} — Blog`,
|
||||
url: `${SITE_URL}/blog`,
|
||||
description: 'Articles, thoughts, and tutorials.',
|
||||
publisher: {
|
||||
'@type': 'Person',
|
||||
name: SITE_NAME,
|
||||
url: SITE_URL,
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(blogListingJsonLd) }}
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(blogJsonLd) }}
|
||||
/>
|
||||
{children}
|
||||
</>
|
||||
|
|
|
|||
Loading…
Reference in New Issue