This repository has been archived by the owner on Jul 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SEO.js
43 lines (41 loc) · 1.51 KB
/
SEO.js
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
import React from 'react'
import Helmet from 'react-helmet'
import config from '../../config/website'
const SEO = () => {
const title = config.siteTitle
const description = config.siteDescription
const realPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix
const image = config.siteUrl + realPrefix + config.siteLogo
const blogURL = config.siteUrl + config.pathPrefix
const schemaOrgJSONLD = [
{
'@context': 'http://schema.org',
'@type': 'WebSite',
url: blogURL,
name: title,
alternateName: config.siteTitleAlt ? config.siteTitleAlt : '',
},
]
return (
<Helmet>
<html lang={config.siteLanguage} />
<title>{title}</title>
<meta name="msapplication-TileColor" content={config.backgroundColor} />
<meta name="description" content={description} />
<meta name="image" content={image} />
<script type="application/ld+json">
{JSON.stringify(schemaOrgJSONLD)}
</script>
<meta property="og:locale" content={config.ogLanguage} />
<meta property="og:site_name" content={config.ogSiteName} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={image} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
</Helmet>
)
}
export default SEO