/
index.tsx
62 lines (53 loc) · 1.99 KB
/
index.tsx
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
import React from 'react';
import { Helmet } from 'react-helmet';
import { useStaticQuery, graphql } from 'gatsby';
import PreviewImageSrc from '../../assets/images/preview.png';
interface Props {
description?: string;
lang?: string;
title: string;
previewImageSrc?: string;
}
const SEO = ({ description, lang, title, previewImageSrc }: Props) => {
const { site } = useStaticQuery(
graphql`
query {
site {
siteMetadata {
title
description
author
}
}
}
`
);
const metaDescription = description || site.siteMetadata.description;
return (
<Helmet titleTemplate={`%s | ${site.siteMetadata.title}`}>
<html lang={lang || 'en'} />
<title>{title}</title>
<meta name="description" content={metaDescription} />
{/* socials */}
<meta property="og:title" content={title} />
<meta property="og:description" content={metaDescription} />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="alexandrtovmach.com" />
<meta property="og:locale" content="en_US" />
<meta property="article:author" content={title} />
<meta property="og:image" content={`https://alexandrtovmach.com${previewImageSrc || PreviewImageSrc}`} />
{/* twitter */}
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content={site.siteMetadata.author} />
<meta name="twitter:site" content={site.siteMetadata.author} />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={metaDescription} />
<meta name="twitter:image" content={`https://alexandrtovmach.com${previewImageSrc || PreviewImageSrc}`} />
{/* personal meta */}
<link rel="me" href="https://alexandrtovmach.com/" type="text/html" />
<link rel="me" href="mailto:alexandrtovmach@gmail.com" />
<link rel="me" href="sms:+380961709568" />
</Helmet>
);
};
export default SEO;