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 (
); }; 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;