Skip to content

Commit b663a84

Browse files
committed
Move filter to graphQL
1 parent 8fc6321 commit b663a84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pages/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default class IndexPage extends React.Component {
1414
<h1 className="has-text-weight-bold is-size-2">Latest Stories</h1>
1515
</div>
1616
{posts
17-
.filter(post => post.node.frontmatter.templateKey === 'blog-post')
1817
.map(({ node: post }) => (
1918
<div
2019
className="content"
@@ -54,7 +53,10 @@ IndexPage.propTypes = {
5453

5554
export const pageQuery = graphql`
5655
query IndexQuery {
57-
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___date] }) {
56+
allMarkdownRemark(
57+
sort: { order: DESC, fields: [frontmatter___date] },
58+
filter: { frontmatter: { templateKey: { eq: "blog-post" } }}
59+
) {
5860
edges {
5961
node {
6062
excerpt(pruneLength: 400)

0 commit comments

Comments
 (0)