Create blog page

This commit is contained in:
LordMathis 2020-10-02 17:42:55 +02:00
parent 2ea1416b2e
commit ca7d9f7c81
1 changed files with 40 additions and 0 deletions

40
src/pages/blog.js Normal file
View File

@ -0,0 +1,40 @@
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import Layout from "../components/layout"
import Blog from "../components/blog"
import "../styles/global.scss"
const IndexPage = () => {
const data = useStaticQuery(graphql`
query {
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
filter: {frontmatter: {draft: {ne: true}}}
) {
edges {
node {
id
excerpt
frontmatter {
date
title
}
}
}
}
}
`)
console.log(data.allMarkdownRemark.edges)
return (
<Layout title="Home">
<Blog edges={data.allMarkdownRemark.edges}/>
</Layout>
)
}
export default IndexPage