text: import React from "react"
  
  import Layout from "../components/layout"
  import SEO from "../components/seo"
  import PostLink from "../components/post-link"
  
  const IndexPage = ({
    data: {
      allMarkdownRemark: { edges }
    }
  }) => {
    const Posts = edges
      .filter(edge => !!edge.node.frontmatter.date) // You can filter your posts based on some criteria
      .map(edge => <PostLink key={edge.node.id} post={edge.node} />)
  
    return (
      <Layout>
        <SEO title="Home" />
        <h1>Chillrun Endurance Home Page</h1>
        <p>Welcome!</p>
        <h2>Posts</h2>
        <div>{Posts}</div>
      </Layout>
    );
  };
  
  export default IndexPage;
  
  export const pageQuery = graphql`
    query {
      allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {
        edges {
          node {
            id
            excerpt(pruneLength: 250)
            frontmatter {
              date(formatString: "MMMM DD, YYYY")
              path
              title
            }
          }
        }
      }
    }
  `;
  