Skip to content

Commit c4cdc60

Browse files
committed
Move sorting section pages to frontend
1 parent cff1ee7 commit c4cdc60

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

gatsby-node.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ exports.createPages = ({ actions, graphql }) => {
3333
return Promise.reject(result.errors)
3434
}
3535

36-
result.data.allMarkdownRemark.edges.sort((a, b) => {
37-
a = a.node.frontmatter.path.toLowerCase();
38-
b = b.node.frontmatter.path.toLowerCase();
39-
40-
return a > b ? -1 : b > a ? 1 : 0;
41-
}).forEach(({ node }) => {
36+
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
4237
createPage({
4338
path: node.frontmatter.path,
4439
component: blogPostTemplate,

src/partials/PagesInThisSection.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ export default () => (
1515

1616
const sectionPages = value.all.filter(o =>
1717
o.path.startsWith(`${sectionPath}/`)
18-
)
18+
).sort((a, b) => {
19+
a = a.path.toLowerCase();
20+
b = b.path.toLowerCase();
21+
22+
return a > b ? 1 : b > a ? -1 : 0;
23+
})
1924

2025
return (
2126
<div>

0 commit comments

Comments
 (0)