Seo.js
3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { cleanImage } from "../../components/imageHandling";
import Head from "next/head";
import React from "react";
const Seo = (props) => {
const imgUrl = cleanImage(props?.seo?.metaImage?.data?.attributes?.url);
const schema = props?.seo?.schema;
const Bschema = props?.seo?.BodySchema;
return (
<>
<Head>
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<title>
{props?.seo?.metaTitle == null
? props?.seo?.metaTitle
: props?.seo?.metaTitle}
</title>
<meta
name="keywords"
content={props?.seo?.keywords == null ? "" : props?.seo?.keywords}
/>
<meta
name="description"
content={
props?.seo?.metaDescription == null
? ""
: props?.seo?.metaDescription
}
/>
<link
rel="canonical"
href={
props?.seo?.canonicalURL == null ? "" : props?.seo?.canonicalURL
}
/>
<link
rel="alternate"
href={
props?.seo?.canonicalURL == null ? "" : props?.seo?.canonicalURL
}
hreflang="en-in"
/>
{/* <meta
name="robots"
content={props?.seo?.metaRobots == null ? "" : props?.seo?.metaRobots}
/>
<meta
name="googlebot"
content={props?.seo?.googlebots == null ? "" : props?.seo?.googlebots}
/> */}
<meta
property="og:title"
content={props?.seo?.metaTitle == null ? "" : props?.seo?.metaTitle}
/>
<meta
property="og:description"
content={
props?.seo?.metaDescription == null
? ""
: props?.seo?.metaDescription
}
/>
{/*twitter card*/}
<meta
name="twitter:title"
content={props?.seo?.metaTitle == null ? "" : props?.seo?.metaTitle}
/>
<meta
name="twitter:description"
content={
props?.seo?.metaDescription == null
? ""
: props?.seo?.metaDescription
}
/>
{/*twitter card*/}
<meta property="og:type" content="website" />
<meta
property="og:url"
content={
props?.seo?.canonicalURL == null ? "" : props?.seo?.canonicalURL
}
/>
<meta property="og:image" content={imgUrl == null ? "" : imgUrl} />
{/* <script type="application/ld+json">{JSON.stringify(props?.seo?.structuredData) == null ? "" : JSON.stringify(props?.seo?.structuredData)}</script> */}
{schema &&
schema.map((item, index) => {
// console.log("item", item);
return (
<script
key={"websiteJSON" + index}
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(item?.jsonSchema, null, 2)
? JSON.stringify(item?.jsonSchema, null, 2)
: "",
}}
></script>
);
})}
</Head>
<>
{Bschema &&
Bschema.map((item, index) => {
// console.log("item", item);
return (
<script
key={"websiteJSON" + index}
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(item?.jsonSchema, null, 2)
? JSON.stringify(item?.jsonSchema, null, 2)
: "",
}}
></script>
);
})}
</>
</>
);
};
export default Seo;