Skip to content

Commit

Permalink
Merge pull request decaporg#63 from terrierscript/blog-post-filter-as…
Browse files Browse the repository at this point in the history
…-gql

Move blog-post filter to graphQL
  • Loading branch information
AustinGreen authored May 21, 2018
2 parents de46a8d + 4a6a250 commit 40c1065
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default class IndexPage extends React.Component {
<h1 className="has-text-weight-bold is-size-2">Latest Stories</h1>
</div>
{posts
.filter(post => post.node.frontmatter.templateKey === 'blog-post')
.map(({ node: post }) => (
<div
className="content"
Expand Down Expand Up @@ -54,7 +53,10 @@ IndexPage.propTypes = {

export const pageQuery = graphql`
query IndexQuery {
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] },
filter: { frontmatter: { templateKey: { eq: "blog-post" } }}
) {
edges {
node {
excerpt(pruneLength: 400)
Expand Down

0 comments on commit 40c1065

Please sign in to comment.