2018-07-17 23:33:55 +02:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import { Link, graphql } from 'gatsby'
|
2018-07-18 00:24:11 +02:00
|
|
|
import Layout from '../components/Layout'
|
2018-07-17 23:33:55 +02:00
|
|
|
|
|
|
|
const IndexPage = ({ data }) => {
|
|
|
|
const edges = data.allMarkdownRemark.edges
|
|
|
|
const Posts = edges
|
|
|
|
// .filter(edge => !!edge.node.frontmatter.date)
|
|
|
|
.map(edge => (
|
|
|
|
<li key={edge.node.id}>
|
|
|
|
<Link to={edge.node.fields.slug}>{edge.node.frontmatter.title}</Link>
|
|
|
|
</li>
|
|
|
|
))
|
|
|
|
|
2018-07-18 00:24:11 +02:00
|
|
|
return (
|
|
|
|
<Layout location={location}>
|
|
|
|
<ul>{Posts}</ul>
|
|
|
|
</Layout>
|
|
|
|
)
|
2018-07-17 23:33:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IndexPage.propTypes = {
|
|
|
|
data: PropTypes.object.isRequired
|
|
|
|
}
|
|
|
|
|
|
|
|
export default IndexPage
|
|
|
|
|
|
|
|
export const indexQuery = graphql`
|
|
|
|
query {
|
|
|
|
allMarkdownRemark(sort: { order: DESC, fields: [fields___date] }) {
|
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
id
|
|
|
|
excerpt(pruneLength: 250)
|
|
|
|
frontmatter {
|
|
|
|
title
|
|
|
|
}
|
|
|
|
fields {
|
|
|
|
slug
|
|
|
|
date(formatString: "MMMM DD, YYYY")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|