Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created November 17, 2018 09:12
Show Gist options
  • Save amandeepmittal/46350ba9db58b21d8660fe470279ebd4 to your computer and use it in GitHub Desktop.
Save amandeepmittal/46350ba9db58b21d8660fe470279ebd4 to your computer and use it in GitHub Desktop.
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