Fetch posts frm wp on blog page
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import React, { Component } from 'react'
|
||||
import Link from 'gatsby-link'
|
||||
|
||||
import Card from '../components/Card'
|
||||
|
||||
class Blog extends Component {
|
||||
render() {
|
||||
const data = this.props.data
|
||||
@@ -8,13 +10,13 @@ class Blog extends Component {
|
||||
<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>
|
||||
<Card
|
||||
url={`blog/${node.slug}`}
|
||||
title={node.title}
|
||||
postId={node.slug}
|
||||
date={node.date}
|
||||
excerpt={node.excerpt}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user