fabien0102 / gatsby-starter

Gatsby 2.0 starter with typescript and many cools dev tools
386 stars 99 forks source link

Tags-Page.tsx template and blog.tsx page - corner case #75

Open i001962 opened 6 years ago

i001962 commented 6 years ago

I believe the Tag-Page template could should use an additional filter.

https://github.com/fabien0102/gatsby-starter/blob/df1edf08e0b420c91a9bc31cd281da4d9ef12be3/src/templates/tags-page.tsx#L9

Proposed to be:

  # Get tags
  tags: allMarkdownRemark(filter: {frontmatter: {draft: {ne: true}}, fileAbsolutePath: {regex: "/blog/"}}) {
    group(field: frontmatter___tags) {
      fieldValue
      totalCount
    }
  }

This is needed if you have a markdown file in a folder other than blog and that file has tags in the frontmatter. This could possibly be resolved for in gatsby-node.js too.

i001962 commented 6 years ago

Also, the same type of filter could be added here

https://github.com/fabien0102/gatsby-starter/blob/df1edf08e0b420c91a9bc31cd281da4d9ef12be3/src/pages/blog.tsx#L103

fileAbsolutePath: {regex: "/blog/"}