-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathseo.jsx
More file actions
168 lines (160 loc) · 5.97 KB
/
seo.jsx
File metadata and controls
168 lines (160 loc) · 5.97 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**
* SEO component that queries for data with
* Gatsby's useStaticQuery React hook
*
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import { useStaticQuery, graphql } from 'gatsby';
import favicon from './../images/favicon-new.ico';
function SEO({ lang,
meta,
title,
slug,
canonical,
metadesc,
keywords,
social_share_summary,
social_share_desc,
social_share_image,
noindex
}) {
const { site } = useStaticQuery(
graphql`
query {
site {
siteMetadata {
title
description
author
}
}
}
`,
);
const isIndexed = !noindex ? 'index, follow' : 'noindex, nofollow'
return (
<Helmet
htmlAttributes={{
lang,
}}
title={title}
titleTemplate={`%s | ${site.siteMetadata.title}`}
meta={[
{
name: 'description',
content: metadesc
},
{
name: 'keywords',
content: keywords
},
{
name: 'google-site-verification',
content: '58TM3lGyGn6c2Bj0PvPQSNzrd9_yBsHs2BjJ6KMHlRU',
},
{
property: 'og:title',
content: title
},
{
property: 'og:description',
content: social_share_desc
},
{
property: 'og:image',
content: social_share_image
},
{
property: 'og:url',
content: `https://testsigma.com${slug}`,
},
{
property: 'og:type',
content: 'website',
},
{
property: 'og:site_name',
content: 'Testsigma Tutorials',
},
{
name: 'twitter:creator',
content: site.siteMetadata.author,
},
{
name: 'twitter:card',
content: social_share_summary
},
{
name: 'twitter:title',
content: title,
},
{
property: 'twitter:description',
content: social_share_desc
},
{
property: 'twitter:image',
content: social_share_image
},
{
property: 'twitter:domain',
content: `https://testsigma.com${slug}`
},
{
property: 'twitter:site',
content: '@testsigmainc',
},
{
name: 'robots',
content: isIndexed
},
].concat(meta)}
>
{/* fav icon */}
<link rel="icon" href={favicon} />
{/* fonts */}
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
<link crossOrigin rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400&display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400&display=swap" rel="stylesheet" />
{/* <link href="https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap" rel="stylesheet" /> */}
{/* <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap" rel="stylesheet" /> */}
{/* Bootstrap */}
{/* <link rel="dns-prefetch" href="https://stackpath.bootstrapcdn.com" /> */}
{/* <link crossOrigin rel="preconnect" href="https://stackpath.bootstrapcdn.com" /> */}
{/* <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossOrigin="anonymous" /> */}
{/* canonical */}
{ canonical ? <link rel="canonical" href={canonical} /> : <link rel="canonical" href={`https://testsigma.com${slug}`} />}
{/* Algolia Instantsearch IE11 support v3 */}
{/* <script src="https://polyfill.io/v3/polyfill.min.js?features=default,Array.prototype.find,Array.prototype.includes" /> */}
{/* */}
{/* Algolia Instantsearch IE11 support v4 */}
<link rel="dns-prefetch" href="https://polyfill.io" />
<link crossOrigin rel="preconnect" href="https://polyfill.io" />
<script src="https://polyfill.io/v3/polyfill.min.js?features=default%2CArray.prototype.find%2CArray.prototype.includes%2CPromise%2CObject.assign%2CObject.entries" />
{/* Algolia API v4 IE11 support */}
<script src="https://polyfill.io/v3/polyfill.min.js?features=Promise%2CObject.entries%2CObject.assign" />
</Helmet>
);
}
SEO.defaultProps = {
lang: 'en',
meta: [],
};
SEO.propTypes = {
lang: PropTypes.string,
meta: PropTypes.arrayOf(PropTypes.object),
title: PropTypes.string.isRequired,
canonical: PropTypes.string,
metadesc: PropTypes.string,
keywords: PropTypes.string,
social_share_summary: PropTypes.string,
social_share_desc: PropTypes.string,
social_share_image: PropTypes.string,
noindex: PropTypes.bool
};
export default SEO;