-
-
Save amandeepmittal/46350ba9db58b21d8660fe470279ebd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { graphql } from 'gatsby'; | |
const Template = ({ data }) => { | |
const title = data.markdownRemark.frontmatter.title; | |
const date = data.markdownRemark.frontmatter.date; | |
const html = data.markdownRemark.html; | |
return ( | |
<div> | |
<h1>{title}</h1> | |
<div className="blogpost" dangerouslySetInnerHTML={{ __html: html }} /> | |
</div> | |
); | |
}; | |
export const postQuery = graphql` | |
query($pathSlug: String!) { | |
markdownRemark(frontmatter: { path: { eq: $pathSlug } }) { | |
html | |
frontmatter { | |
title | |
date(formatString: "MMMM, DD, YYYY") | |
path | |
tags | |
excerpt | |
} | |
} | |
} | |
`; | |
export default Template; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment