-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.js
50 lines (45 loc) · 1.25 KB
/
default.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
44
45
46
47
48
49
50
import React from 'react'
import { graphql } from 'gatsby'
import Layout from '../layout/'
import PageSection from '../theme/components/atoms/PageSection'
import ContentContainer from '../theme/components/atoms/ContentContainer'
import MarkupContainer from '../theme/components/atoms/MarkupContainer'
import MetaData from '../components/MetaData'
const DefaultTemplate = ({ data, location }) => {
const __html = data.postBySlug.html
const frontmatter = data.postBySlug.frontmatter
const metaData = frontmatter.metaData || {}
if (!metaData.titleParts && frontmatter.title) {
metaData.titleParts = [frontmatter.title]
}
return (
<Layout location={location}>
<PageSection lg>
<ContentContainer>
<MetaData {...metaData} />
<MarkupContainer
dangerouslySetInnerHTML={{
__html
}}
/>
</ContentContainer>
</PageSection>
</Layout>
)
}
export default DefaultTemplate
export const pageQuery = graphql`
query ContentBySlug($slug: String!) {
postBySlug: markdownRemark(fields: { slug: { eq: $slug } }) {
html
frontmatter {
title
metaData {
titleParts
description
image
}
}
}
}
`