Skip to content

Commit cc63ea2

Browse files
committed
Cambios en descripcion y FAQ
1 parent 65f591a commit cc63ea2

File tree

1 file changed

+60
-12
lines changed

1 file changed

+60
-12
lines changed

src/templates/LandingPage.js

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,75 @@
11
import React, { useRef } from "react"
22
import { graphql } from "gatsby"
3+
import PropTypes from "prop-types"
4+
import { Helmet } from "react-helmet"
35
import Layout from "../components/layout"
46
import { CustomSection, Seo, Navigation } from "../components/index"
5-
import PropTypes from "prop-types"
67

78
const LandingPage = ({ data, location }) => {
89
const { name, slug, parent_page, seo, body, navigation } =
910
data?.allStrapiLandingPage?.nodes[0] || {}
1011

1112
const wrapperRef = useRef(null)
13+
14+
// ---- FAQs (MISMA LÓGICA QUE ESPAÑOL) ----
15+
const faqs = (body || [])
16+
.filter(block => block.strapi_component === "components.banner-list")
17+
.flatMap(block =>
18+
(block.Card || [])
19+
.filter(card => card.description && card.description.trim() !== "")
20+
.map(({ id, title, description }) => ({
21+
"@type": "Question",
22+
name: title,
23+
acceptedAnswer: {
24+
"@type": "Answer",
25+
text: description,
26+
},
27+
"@id": `#faq-${id}`,
28+
}))
29+
)
30+
31+
const pageLd = {
32+
"@context": "https://schema.org",
33+
"@type": "WebPage",
34+
name: seo?.pageTitle || name,
35+
description: seo?.pageDescription,
36+
url: `https://en.bitlogic.io/${slug}`,
37+
}
38+
39+
const faqLd =
40+
faqs.length > 0
41+
? {
42+
"@context": "https://schema.org",
43+
"@type": "FAQPage",
44+
mainEntity: faqs,
45+
}
46+
: null
47+
1248
const landing = {
1349
name,
1450
slug,
1551
parent_page,
1652
ref: wrapperRef,
1753
}
1854

19-
const {pageTitle, pageKeywords, pageDescription } = seo || {}
20-
2155
return (
2256
<Layout location={location} options={{ hasHeader: true }}>
23-
<Seo title={pageTitle} description={pageDescription} keywords={pageKeywords} location={location} />
57+
<Seo
58+
title={seo?.pageTitle || name}
59+
description={seo?.pageDescription}
60+
keywords={seo?.pageKeywords}
61+
/>
62+
<Helmet>
63+
<script type="application/ld+json">
64+
{JSON.stringify(pageLd)}
65+
</script>
66+
{faqLd && (
67+
<script type="application/ld+json">
68+
{JSON.stringify(faqLd)}
69+
</script>
70+
)}
71+
</Helmet>
72+
2473
{body?.length > 0 && navigation ? (
2574
<>
2675
<CustomSection sections={body.slice(0, 1)} />
@@ -49,7 +98,7 @@ LandingPage.propTypes = {
4998
name: PropTypes.string.isRequired,
5099
body: PropTypes.arrayOf(PropTypes.object),
51100
seo: PropTypes.shape({
52-
pageTitle: PropTypes.string,
101+
pageTitle: PropTypes.string.isRequired,
53102
pageDescription: PropTypes.string.isRequired,
54103
pageKeywords: PropTypes.string,
55104
}),
@@ -234,14 +283,13 @@ export const query = graphql`
234283
slug
235284
}
236285
}
237-
arrayButtons {
238-
content
239-
240-
english_landing_page {
241-
id
242-
slug
243-
}
286+
arrayButtons {
287+
content
288+
english_landing_page {
289+
id
290+
slug
244291
}
292+
}
245293
backgroundImageDark {
246294
url
247295
}

0 commit comments

Comments
 (0)