2017-08-20 14:43:49 +03:00
|
|
|
import React from 'react';
|
|
|
|
import Helmet from 'react-helmet';
|
|
|
|
import PostTemplateDetails from '../components/PostTemplateDetails';
|
|
|
|
|
|
|
|
class PostTemplate extends React.Component {
|
|
|
|
render() {
|
|
|
|
const { title, subtitle } = this.props.data.site.siteMetadata;
|
|
|
|
const post = this.props.data.markdownRemark;
|
2018-01-21 03:03:59 +03:00
|
|
|
const { title: postTitle, description: postDescription } = post.frontmatter;
|
|
|
|
const description = postDescription !== null ? postDescription : subtitle;
|
2017-08-20 14:43:49 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Helmet>
|
2018-01-21 03:03:59 +03:00
|
|
|
<title>{`${postTitle} - ${title}`}</title>
|
2017-08-20 14:43:49 +03:00
|
|
|
<meta name="description" content={description} />
|
|
|
|
</Helmet>
|
|
|
|
<PostTemplateDetails {...this.props} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PostTemplate;
|
|
|
|
|
|
|
|
export const pageQuery = graphql`
|
|
|
|
query PostBySlug($slug: String!) {
|
|
|
|
site {
|
|
|
|
siteMetadata {
|
|
|
|
title
|
|
|
|
subtitle
|
|
|
|
copyright
|
|
|
|
author {
|
|
|
|
name
|
|
|
|
twitter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
markdownRemark(fields: { slug: { eq: $slug } }) {
|
|
|
|
id
|
|
|
|
html
|
|
|
|
fields {
|
|
|
|
tagSlugs
|
|
|
|
}
|
|
|
|
frontmatter {
|
|
|
|
title
|
|
|
|
tags
|
|
|
|
date
|
|
|
|
description
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|