import React from 'react'; import Helmet from 'react-helmet'; import PostTemplateDetails from '../components/PostTemplateDetails'; class PostTemplate extends React.Component { render() { const siteMetadata = this.props.data.site.siteMetadata; const { title, subtitle } = siteMetadata; const post = this.props.data.markdownRemark; const { title: postTitle, description: postDescription } = post.frontmatter; const description = postDescription !== null ? postDescription : subtitle; return (
{`${postTitle} - ${title}`}
); } } export default PostTemplate; export const pageQuery = graphql` query PostBySlug($slug: String!) { site { siteMetadata { title subtitle author { name twitter } disqusShortname url } } markdownRemark(fields: { slug: { eq: $slug } }) { id html fields { tagSlugs } frontmatter { title tags date description } } } `;