text: import React from "react"
  import Layout from "../components/Layout"
  import { Link, graphql, useStaticQuery } from "gatsby"
  
  const BlogPage = () => {
    const data = useStaticQuery(graphql`
      query {
        allMarkdownRemark {
          edges {
            node {
              frontmatter {
                title
                date
              }
              fields {
                slug
              }
            }
          }
        }
      }
    `)
    return (
      <Layout>
        <h1>Blogs</h1>
        <ol>
          {data.allMarkdownRemark.edges.map((edge, index) => {
            return (
              <li key={index}>
                <Link to={`/blog/${edge.node.fields.slug}`}>
                  <h2>{edge.node.frontmatter.title}</h2>
                  <p>{edge.node.frontmatter.date}</p>
                </Link>
              </li>
            )
          })}
        </ol>
      </Layout>
    )
  }
  
  export default BlogPage
  