Skip to content

Instantly share code, notes, and snippets.

@brookslyrette
Created December 31, 2018 14:55
Show Gist options
  • Save brookslyrette/25b26615cb9c7add4c3be285fcc05180 to your computer and use it in GitHub Desktop.
Save brookslyrette/25b26615cb9c7add4c3be285fcc05180 to your computer and use it in GitHub Desktop.
import React from 'react'
import { Link, graphql } from 'gatsby'
import Layout from '../components/layout'
import SEO from '../components/seo'
const IndexPage = ({ data }) => {
return (
<Layout>
<SEO title="Home" keywords={[`gatsby`, `application`, `react`]} />
<ul>
{data.allPostsJson.edges.map(post => (
<li key={post.node.id}>
<Link to={post.node.slug}>{post.node.title}</Link>
</li>
))}
</ul>
</Layout>
)
}
export const query = graphql`{
allPostsJson(sort: { fields: published_at, order: DESC }, filter: { status: { eq: "published" } }) {
edges {
node {
id, slug, title, published_at, status, markdown
}
}
}
}`
export default IndexPage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment