From fd6f93660e2b946fb0032c653298cdbc09ea6431 Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Sun, 24 Feb 2019 23:48:01 +0100 Subject: [PATCH] Real post images on front page --- src/components/PostList.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/PostList.js b/src/components/PostList.js index 72723ee..8dab55a 100644 --- a/src/components/PostList.js +++ b/src/components/PostList.js @@ -1,6 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import { Link, graphql } from 'gatsby' +import Img from 'gatsby-image' export default class PostList extends React.Component { render() { @@ -12,10 +13,13 @@ export default class PostList extends React.Component {
{posts.map(({ node: post }) => ( - + {post.featured_media && post.featured_media.localFile && ( +
+ +
+ )}

{post.title}

@@ -58,5 +62,10 @@ export const pageQuery = graphql` fields { link } + featured_media { + localFile { + ...FluidImage + } + } } `