From f33cfac7187c37444720006abcb368153ba7a859 Mon Sep 17 00:00:00 2001 From: Moris Zen Date: Fri, 6 Jul 2018 13:28:39 +0200 Subject: [PATCH] Query for indexing posts on landing page --- src/layouts/index.js | 12 +---------- src/pages/index.js | 48 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/layouts/index.js b/src/layouts/index.js index 0141ef9..1a98bc0 100644 --- a/src/layouts/index.js +++ b/src/layouts/index.js @@ -11,7 +11,7 @@ import '../styles/custom.css' const Layout = ({ children, data }) => (
( +const IndexPage = ({ ...props }) => (
@@ -148,8 +148,22 @@ const IndexPage = () => ( headline="But occasionally we find the time to have fun and publish stuff" />
- - + {props.data.allWordpressPost.edges.map(({ node }) => ( +
+ +
+ ))}
) +export const query = graphql` + query indexPostsQuery { + allWordpressPost { + edges { + node { + id + title + excerpt + status + slug + date(formatString: "MMMM DD, YYYY") + featured_media { + localFile { + childImageSharp { + resolutions(width: 600, height: 300) { + src + width + height + } + } + } + } + } + } + } + } +` + export default IndexPage