|
1 | 1 | import React, { useRef } from "react" |
2 | 2 | import { graphql } from "gatsby" |
| 3 | +import Layout from "../components/layout" |
| 4 | +import { CustomSection, Seo, Navigation } from "../components/index" |
3 | 5 | import PropTypes from "prop-types" |
4 | | -import { Helmet } from "react-helmet" |
5 | | -import { Seo, CustomSection, Navigation, Layout } from "../components" |
6 | 6 |
|
7 | 7 | const LandingPage = ({ data, location }) => { |
8 | 8 | const { name, slug, parent_page, seo, body, navigation } = |
9 | 9 | data?.allStrapiLandingPage?.nodes[0] || {} |
10 | 10 |
|
11 | 11 | const wrapperRef = useRef(null) |
12 | | - |
13 | | - const faqs = (body || []) |
14 | | - .filter(block => block.strapi_component === "components.banner-list") |
15 | | - .flatMap(block => |
16 | | - (block.Card || []) |
17 | | - .filter(card => card.description && card.description.trim() !== "") |
18 | | - .map(({ id, title, description }) => ({ |
19 | | - "@type": "Question", |
20 | | - name: title, |
21 | | - acceptedAnswer: { |
22 | | - "@type": "Answer", |
23 | | - text: description, |
24 | | - }, |
25 | | - "@id": `#faq-${id}`, |
26 | | - })) |
27 | | - ) |
28 | | - const pageLd = { |
29 | | - "@context": "https://schema.org", |
30 | | - "@type": "WebPage", |
31 | | - name: seo?.pageTitle || name, |
32 | | - description: seo?.pageDescription, |
33 | | - url: `https://en.bitlogic.io/${slug}`, |
34 | | - } |
35 | | - const faqLd = |
36 | | - faqs.length > 0 |
37 | | - ? { |
38 | | - "@context": "https://schema.org", |
39 | | - "@type": "FAQPage", |
40 | | - mainEntity: faqs, |
41 | | - } |
42 | | - : null |
43 | | - |
44 | 12 | const landing = { |
45 | 13 | name, |
46 | 14 | slug, |
47 | 15 | parent_page, |
48 | 16 | ref: wrapperRef, |
49 | 17 | } |
50 | 18 |
|
| 19 | + const {pageTitle, pageKeywords, pageDescription } = seo || {} |
| 20 | + |
51 | 21 | return ( |
52 | 22 | <Layout location={location} options={{ hasHeader: true }}> |
53 | | - <Seo |
54 | | - title={seo?.pageTitle || name} |
55 | | - description={seo?.pageDescription} |
56 | | - keywords={seo?.pageKeywords} |
57 | | - /> |
58 | | - <Helmet> |
59 | | - <script type="application/ld+json"> |
60 | | - {JSON.stringify(pageLd)} |
61 | | - </script> |
62 | | - {faqLd && ( |
63 | | - <script type="application/ld+json"> |
64 | | - {JSON.stringify(faqLd)} |
65 | | - </script> |
66 | | - )} |
67 | | - </Helmet> |
| 23 | + <Seo title={pageTitle} description={pageDescription} keywords={pageKeywords} location={location} /> |
68 | 24 | {body?.length > 0 && navigation ? ( |
69 | 25 | <> |
70 | 26 | <CustomSection sections={body.slice(0, 1)} /> |
|
0 commit comments