mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-03-14 03:18:38 +01:00
59 lines
1.1 KiB
JavaScript
59 lines
1.1 KiB
JavaScript
|
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 {
|
||
|
tagSlugs
|
||
|
}
|
||
|
frontmatter {
|
||
|
date
|
||
|
description
|
||
|
tags
|
||
|
title
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
`;
|
||
|
|
||
|
export default PostTemplate;
|