Ajout du schema JSON-LD BlogPosting pour les articles photo
Les photo blog posts génèrent maintenant un JSON-LD BlogPosting avec headline, datePublished et lien vers le schema Person via @id. PhotoBlogPostContent passe description, date et tags à PhotoLayout qui les transmet au composant SEO.
This commit is contained in:
parent
c0cb3e08a0
commit
91296ecdf5
3 changed files with 34 additions and 2 deletions
|
|
@ -76,6 +76,22 @@ const personJsonLd = {
|
|||
],
|
||||
};
|
||||
|
||||
// Article JSON-LD (for blog posts / articles)
|
||||
const articleJsonLd =
|
||||
ogType === "article" && article
|
||||
? {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
headline: title,
|
||||
description,
|
||||
image: imageUrl,
|
||||
url: canonicalUrl,
|
||||
inLanguage: locale,
|
||||
...(article.publishedTime && { datePublished: article.publishedTime }),
|
||||
author: { "@id": `${siteUrl}/#person` },
|
||||
}
|
||||
: null;
|
||||
|
||||
// WebSite JSON-LD (only on home pages)
|
||||
const websiteJsonLd = isHomePage
|
||||
? {
|
||||
|
|
@ -129,6 +145,11 @@ const websiteJsonLd = isHomePage
|
|||
<!-- JSON-LD Person -->
|
||||
<script type="application/ld+json" set:html={JSON.stringify(personJsonLd)} />
|
||||
|
||||
<!-- JSON-LD Article (blog posts only) -->
|
||||
{articleJsonLd && (
|
||||
<script type="application/ld+json" set:html={JSON.stringify(articleJsonLd)} />
|
||||
)}
|
||||
|
||||
<!-- JSON-LD WebSite (home pages only) -->
|
||||
{websiteJsonLd && (
|
||||
<script type="application/ld+json" set:html={JSON.stringify(websiteJsonLd)} />
|
||||
|
|
|
|||
|
|
@ -53,7 +53,14 @@ const lightboxImages = galleryImages.map(img => ({
|
|||
}));
|
||||
---
|
||||
|
||||
<PhotoLayout title={`${post.data.title} - Blog Photo - Jalil Arfaoui`} enableScroll={true} lang={lang}>
|
||||
<PhotoLayout
|
||||
title={`${post.data.title} - Blog Photo - Jalil Arfaoui`}
|
||||
description={post.data.description}
|
||||
ogType="article"
|
||||
article={{ publishedTime: new Date(post.data.date).toISOString(), tags: post.data.tags }}
|
||||
enableScroll={true}
|
||||
lang={lang}
|
||||
>
|
||||
<div class="album-container">
|
||||
<CategoryNav currentCategory="blog" opaque={false} lang={lang} />
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import type { Locale } from '../utils/i18n';
|
|||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
ogType?: string;
|
||||
article?: { publishedTime?: string; tags?: string[] };
|
||||
enableScroll?: boolean;
|
||||
lang?: Locale;
|
||||
}
|
||||
|
|
@ -13,6 +15,8 @@ interface Props {
|
|||
const {
|
||||
title = "Galerie Photo - Jalil Arfaoui",
|
||||
description = "Portfolio photo de Jalil Arfaoui. Portraits, paysages, cultures, musique, nature.",
|
||||
ogType,
|
||||
article,
|
||||
enableScroll = false,
|
||||
lang = 'fr',
|
||||
} = Astro.props;
|
||||
|
|
@ -24,7 +28,7 @@ const {
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{title}</title>
|
||||
<SEO title={title} description={description} />
|
||||
<SEO title={title} description={description} ogType={ogType} article={article} />
|
||||
|
||||
<!-- Google Fonts - Karla -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue