Skip to content

Commit 0f02f84

Browse files
Merge pull request #94 from bitlogic/SBIT-490
datos estructurados para los blogs
2 parents 9d295ed + 8d81ac1 commit 0f02f84

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/templates/BlogItemDetail.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,53 @@ import Layout from "../components/layout"
55
import { Seo, BannerTop } from "../components/index.js"
66
import "./BlogItemDetail.scss"
77
import PropTypes from "prop-types"
8+
import { Helmet } from "react-helmet"
89
import { getImage, GatsbyImage } from "gatsby-plugin-image"
910

1011
const BlogDetail = ({ data }) => {
11-
const { title, description, image, imagePage, author, seo } =
12+
const { title, description, image, imagePage, author, seo, published_at, updated_at } =
1213
data?.allStrapiArticle?.nodes[0] || {}
1314

1415
const bannerTop = imagePage ? { title, imagePage } : { title, image }
1516

17+
const structuredData = {
18+
"@context": "https://schema.org",
19+
"@type": "Article",
20+
"headline": seo?.pageTitle || title, // Usa pageTitle de SEO o el título
21+
"description": seo?.pageDescription || description,
22+
"image": imagePage?.url || image?.url, // Imagen principal
23+
"author": author?.map(auth => ({
24+
"@type": "Person",
25+
"name": auth.name,
26+
})),
27+
"datePublished": published_at, // Ajusta con la fecha real
28+
"dateModified": updated_at, // Ajusta con la fecha real
29+
"mainEntityOfPage": {
30+
"@type": "WebPage",
31+
"@id": `https://es.bitlogic.io/blog/${data?.allStrapiArticle?.nodes[0]?.slug}`,
32+
},
33+
"publisher": {
34+
"@type": "Organization",
35+
"name": "Bitlogic",
36+
"logo": {
37+
"@type": "ImageObject",
38+
"url": "https://bitlogic.io/static/64f396cb88cfcbfda46b86c5218242f2/de081/Logo_Bit_azul_7e725e9726.webp", // URL del logo del sitio
39+
},
40+
},
41+
}
42+
1643
return (
1744
<Layout>
1845
<Seo
1946
title={seo?.pageTitle}
2047
description={seo?.pageDescription}
2148
keywords={seo?.pageKeywords}
2249
/>
50+
<Helmet>
51+
<script type="application/ld+json">
52+
{JSON.stringify(structuredData)}
53+
</script>
54+
</Helmet>
2355
<BannerTop banner={bannerTop} />
2456
<div className="detail__container row">
2557
<div className="col-lg-12">
@@ -110,6 +142,8 @@ export const query = graphql`
110142
title
111143
description
112144
slug
145+
published_at
146+
updated_at
113147
seo {
114148
pageTitle
115149
pageDescription

0 commit comments

Comments
 (0)