1.查数据
{
allMarkdownRemark(sort: {order: DESC, fields: [frontmatter___date]}) {
edges {
node {
frontmatter {
title
path
date
excerpt
}
}
}
}
}
如图所示:
2.套页面
打开index.js
import React from "react"
import Header from '../components/header'
import { Link,graphql } from 'gatsby'
const Layout = ({ data }) => {
const { edges } = data.allMarkdownRemark;
return (
<div>
<Header /&