Use PageContext to Display Tags in Gatsby

Share this video with your friends

Send Tweet

Gatsby uses PageContext to pass additional information into a React component. In this lesson we will update our Tag page templates to display data.

Andrew Alekseev
Andrew Alekseev
~ 6 years ago

To be able to display the title of a post by {post.frontmatter.title}, in singleTagIndex.js should be added in gatsby-node.js in graphql query in frontmatter a title.

Josh Schoen
Josh Schoen
~ 5 years ago

Missing comma in the transcript after singleTagIndexTemplate

  createPage({
    path: '/tags/${tagName}',
    component: singleTagIndexTemplate, 
    context: {
      posts,
      tagName 

    }
  })
})