mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-01-29 23:02:41 +01:00
53 lines
1.1 KiB
JavaScript
53 lines
1.1 KiB
JavaScript
|
import React from 'react';
|
||
|
import { graphql } from 'gatsby';
|
||
|
import Layout from '../components/Layout';
|
||
|
import Sidebar from '../components/Sidebar';
|
||
|
import Page from '../components/Page';
|
||
|
|
||
|
const PageTemplate = ({ data }) => {
|
||
|
const {
|
||
|
title: siteTitle,
|
||
|
subtitle: siteSubtitle
|
||
|
} = data.site.siteMetadata;
|
||
|
|
||
|
const {
|
||
|
title: pageTitle,
|
||
|
description: pageDescription
|
||
|
} = data.markdownRemark.frontmatter;
|
||
|
|
||
|
const { html: pageBody } = data.markdownRemark;
|
||
|
|
||
|
const metaDescription = pageDescription !== null ? pageDescription : siteSubtitle;
|
||
|
|
||
|
return (
|
||
|
<Layout title={`${pageTitle} - ${siteTitle}`} description={metaDescription}>
|
||
|
<Sidebar />
|
||
|
<Page title={pageTitle}>
|
||
|
<div dangerouslySetInnerHTML={{ __html: pageBody }} />
|
||
|
</Page>
|
||
|
</Layout>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export const query = graphql`
|
||
|
query PageBySlug($slug: String!) {
|
||
|
site {
|
||
|
siteMetadata {
|
||
|
title
|
||
|
subtitle
|
||
|
}
|
||
|
}
|
||
|
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||
|
id
|
||
|
html
|
||
|
frontmatter {
|
||
|
title
|
||
|
date
|
||
|
description
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
`;
|
||
|
|
||
|
export default PageTemplate;
|