import React from 'react' import PropTypes from 'prop-types' import Helmet from 'react-helmet' import { graphql, Link } from 'gatsby' import Layout from '../components/Layout' import Img from 'gatsby-image' export const BlogPostTemplate = ({ content, categories, tags, title, date, author, featuredMedia, }) => { const hasFeaturedMedia = featuredMedia && !!featuredMedia.localFile return (

{title}

{date} av {author.name}

{hasFeaturedMedia && (
)}
) } BlogPostTemplate.propTypes = { content: PropTypes.node.isRequired, title: PropTypes.string, } const BlogPost = ({ data }) => { const { wordpressPost: post } = data return ( ) } BlogPost.propTypes = { data: PropTypes.shape({ markdownRemark: PropTypes.object, }), } export default BlogPost export const pageQuery = graphql` fragment FluidImage on File { childImageSharp { fluid(maxWidth: 800) { ...GatsbyImageSharpFluid } } } fragment PostFields on wordpress__POST { id slug content date(formatString: "MMMM DD, YYYY") title } query BlogPostByID($id: String!) { wordpressPost(id: { eq: $id }) { id title slug content date(formatString: "MMMM DD, YYYY") categories { name slug } tags { name slug } author { name slug } featured_media { localFile { ...FluidImage } } } } `