File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ path : " /hello-world"
3
+ date : " 2017-09-02T18:12:33.962Z"
4
+ title : " Hello World"
5
+ ---
6
+
7
+ This is my first blog post!
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import Helmet from 'react-helmet' ;
3
+
4
+ export default function Template ( { data } ) {
5
+ const { markdownRemark : post } = data ; // data.markdownRemark holds our post data
6
+ return (
7
+ < div className = "blog-post-container" >
8
+ < Helmet title = { `Blog - ${ post . frontmatter . title } ` } />
9
+ < div className = "blog-post" >
10
+ < h1 > { post . frontmatter . title } </ h1 >
11
+ < div className = "blog-post-content" dangerouslySetInnerHTML = { { __html : post . html } } />
12
+ </ div >
13
+ </ div >
14
+ ) ;
15
+ }
16
+
17
+ export const pageQuery = graphql `
18
+ query BlogPostByPath($path: String!) {
19
+ markdownRemark(frontmatter: { path: { eq: $path } }) {
20
+ html
21
+ frontmatter {
22
+ path
23
+ date(formatString: "MMMM DD, YYYY")
24
+ title
25
+ }
26
+ }
27
+ }
28
+ ` ;
You can’t perform that action at this time.
0 commit comments