33 lines
738 B
JavaScript
33 lines
738 B
JavaScript
|
import React, { useEffect } from "react"
|
||
|
import { graphql } from "gatsby"
|
||
|
import Layout from "../components/layout"
|
||
|
|
||
|
export default function Template({
|
||
|
data, // this prop will be injected by the GraphQL query below.
|
||
|
}) {
|
||
|
const { markdownRemark } = data // data.markdownRemark holds your post data
|
||
|
const { frontmatter, html } = markdownRemark
|
||
|
|
||
|
useEffect(() => {
|
||
|
document.title = frontmatter.title
|
||
|
}, [frontmatter.title])
|
||
|
|
||
|
return (
|
||
|
<Layout>
|
||
|
<div dangerouslySetInnerHTML={{ __html: html }}></div>
|
||
|
</Layout>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
export const pageQuery = graphql`
|
||
|
query($path: String!) {
|
||
|
markdownRemark(frontmatter: { path: { eq: $path } }) {
|
||
|
html
|
||
|
frontmatter {
|
||
|
path
|
||
|
title
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
`
|