2018-11-09 20:08:48 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { graphql } from 'gatsby';
|
|
|
|
import Layout from '../components/Layout';
|
|
|
|
import Post from '../components/Post';
|
|
|
|
|
|
|
|
const PostTemplate = ({ data }) => {
|
|
|
|
const {
|
|
|
|
title: siteTitle,
|
|
|
|
subtitle: siteSubtitle
|
|
|
|
} = data.site.siteMetadata;
|
|
|
|
|
|
|
|
const {
|
|
|
|
title: postTitle,
|
|
|
|
description: postDescription
|
|
|
|
} = data.markdownRemark.frontmatter;
|
|
|
|
|
|
|
|
const metaDescription = postDescription !== null ? postDescription : siteSubtitle;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Layout title={`${postTitle} - ${siteTitle}`} description={metaDescription}>
|
|
|
|
<Post post={data.markdownRemark} />
|
|
|
|
</Layout>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const query = graphql`
|
|
|
|
query PostBySlug($slug: String!) {
|
|
|
|
site {
|
|
|
|
siteMetadata {
|
|
|
|
author {
|
|
|
|
name
|
|
|
|
contacts {
|
|
|
|
twitter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
disqusShortname
|
|
|
|
subtitle
|
|
|
|
title
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
markdownRemark(fields: { slug: { eq: $slug } }) {
|
|
|
|
id
|
|
|
|
html
|
|
|
|
fields {
|
2019-02-07 15:08:12 -05:00
|
|
|
slug
|
2018-11-09 20:08:48 +03:00
|
|
|
tagSlugs
|
|
|
|
}
|
|
|
|
frontmatter {
|
|
|
|
date
|
|
|
|
description
|
|
|
|
tags
|
|
|
|
title
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default PostTemplate;
|