Add a List of Posts using a GraphQL Page Query

Laurie Barth
InstructorLaurie Barth

Share this video with your friends

Send Tweet

Inside of index.js, create a page query that grabs allMDX nodes, and in each node, grab the slug and title, that's available via the frontmatter.

Additionally, create a filter to sort all results using the frontmatter title field. Map through each post using the result of the query in the data object.

Finally, use the Link component and the slugs provided by the query result to link to each post.