Skip to content

Commit

Permalink
Move filter to graphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
terrierscript committed Mar 29, 2018
1 parent 75eb937 commit 4a6a250
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 4a6a250

Please sign in to comment.