-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.jsx
46 lines (44 loc) · 1.01 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from "react";
import { graphql } from "gatsby";
import Layout from "../../layout";
import PostListing from "../../components/PostListing";
export default ({ pageContext, data }) => {
const { category } = pageContext;
const postEdges = data.allMarkdownRemark.edges;
return (
<Layout>
<div className="category-container">
<div>Posts posted to {category}</div>
<PostListing postEdges={postEdges} />
</div>
</Layout>
);
};
/* eslint no-undef: "off" */
export const pageQuery = graphql`
query CategoryPage($category: String) {
allMarkdownRemark(
limit: 1000
sort: { fields: [fields___date], order: DESC }
filter: { frontmatter: { category: { eq: $category } } }
) {
totalCount
edges {
node {
fields {
slug
date
}
excerpt
timeToRead
frontmatter {
title
tags
author
date
}
}
}
}
}
`;