-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.js
37 lines (36 loc) · 972 Bytes
/
meta.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
import React from 'react'
import Helmet from 'react-helmet'
import get from 'lodash/get'
const Meta = ({ image, path = '', site, title }) => {
const siteUrl = get(site, 'url')
const siteTitle = get(site, 'title')
title = title ? `${title} | ${siteTitle}` : siteTitle
image = image ? `${siteUrl}${image}` : `${siteUrl}/img/back.jpeg`
return (
<Helmet
title={title}
meta={[
{ name: 'twitter:card', content: 'summary' },
{
name: 'twitter:site',
content: `@${get(site, 'twitter')}`,
},
{ property: 'og:title', content: title },
{ property: 'og:type', content: 'website' },
{
property: 'og:description',
content: get(site, 'description'),
},
{
property: 'og:url',
content: `${siteUrl}${path}`,
},
{
property: 'og:image',
content: image,
},
]}
/>
)
}
export default Meta