Fetching Blog Posts config

This commit is contained in:
Moris Zen
2018-07-05 20:56:44 +02:00
parent 5eb158ea28
commit b3a9a16a59

View File

@@ -1,9 +1,23 @@
import React, { Component } from 'react'
import Link from 'gatsby-link'
class Blog extends Component {
render() {
const { data } = this.props
return <div>Blog Page</div>
const data = this.props.data
return (
<div>
<h1>Blog Posts</h1>
{data.allWordpressPost.edges.map(({ node }) => (
<article key={node.slug}>
<Link to={`post/${node.slug}`}>
<h3>{node.title}</h3>
</Link>
{node.date}
<p dangerouslySetInnerHTML={{ __html: node.excerpt }} />
</article>
))}
</div>
)
}
}