-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathhead.js
27 lines (21 loc) · 888 Bytes
/
head.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
import React from 'react'
import useSiteMetdata from './hooks/use-site-metadata'
const buildTitle = (...parts) => [...new Set(parts.filter(Boolean))].join(' | ')
export const Head = ({pageContext: {frontmatter = {}}}) => {
const siteMetadata = useSiteMetdata()
const title = buildTitle(frontmatter.title, siteMetadata.title)
const description = frontmatter.description || siteMetadata.description
return (
<>
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={siteMetadata.imageUrl} />
<meta property="twitter:card" content="summary_large_image" />
<html lang={siteMetadata.lang} />
</>
)
}
const PassThrough = ({children}) => children
export default PassThrough