Outline
Let's use our query as a page query at the end of event-layout.js
:
// src/pages/event-layout.js
export const pageQuery = graphql`
query EventPageQuery($id: String) {
mdx(id: { eq: $id }) {
body
frontmatter {
date
title
category
}
id
}
}
`
If you restart the development server with gatsby develop
, you should be able to navigate to localhost:8000/events/2019-11-12-game-night
(or whatever you named your Markdown file). You can even make changes to the Markdown and see it update live!
In the next video, I've got an assignment for you to get you more practice with Markdown and Gatsby.