Skip to content

Commit 36efcde

Browse files
committed
Ran sort-and-aggr-graphql codemod
1 parent 8dcdca5 commit 36efcde

File tree

4 files changed

+24
-29
lines changed

4 files changed

+24
-29
lines changed

gatsby-config.js

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,24 @@ module.exports = {
8787
author: byline,
8888
})
8989
),
90-
query: `
91-
{
92-
allMarkdownRemark(
93-
filter: {frontmatter: {layout: {eq: "blog"}}},
94-
sort: { order: DESC, fields: [frontmatter___date] }
95-
) {
96-
edges {
97-
node {
98-
excerpt
99-
frontmatter {
100-
title
101-
date
102-
permalink
103-
byline
104-
}
105-
}
106-
}
107-
}
108-
}
109-
`,
90+
query: `{
91+
allMarkdownRemark(
92+
filter: {frontmatter: {layout: {eq: "blog"}}}
93+
sort: {frontmatter: {date: DESC}}
94+
) {
95+
edges {
96+
node {
97+
excerpt
98+
frontmatter {
99+
title
100+
date
101+
permalink
102+
byline
103+
}
104+
}
105+
}
106+
}
107+
}`,
110108
output: "/blog/rss.xml",
111109
title: "Blog | GraphQL",
112110
feed_url: "http://graphql.org/blog/rss.xml",

gatsby-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ exports.onCreatePage = async ({ page, actions }) => {
204204
exports.createPages = async ({ graphql, actions }) => {
205205
const { createPage } = actions
206206

207-
const result = await graphql(/* GraphQL */ `
208-
query {
207+
const result = await graphql(`
208+
{
209209
allMarkdownRemark {
210210
edges {
211211
node {
@@ -231,7 +231,7 @@ exports.createPages = async ({ graphql, actions }) => {
231231
}
232232
}
233233
allBlogPost {
234-
group(field: tags) {
234+
group(field: { tags: SELECT }) {
235235
fieldValue
236236
}
237237
}

src/components/BlogSidebar/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ const BlogSidebar: React.FC = () => {
66
const data = useStaticQuery<Queries.AllTagsStaticQuery>(graphql`
77
query AllTagsStatic {
88
allBlogPost {
9-
group(field: tags) {
9+
group(field: { tags: SELECT }) {
1010
fieldValue
1111
}
1212
}
13-
allRecentBlogPost: allBlogPost(
14-
limit: 30
15-
sort: { fields: [date], order: DESC }
16-
) {
13+
allRecentBlogPost: allBlogPost(limit: 30, sort: { date: DESC }) {
1714
nodes {
1815
title
1916
postId

src/pages/blog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Seo from "../components/Seo"
88

99
export const query = graphql`
1010
query BlogPostListPage {
11-
allBlogPost(sort: { fields: [date], order: DESC }) {
11+
allBlogPost(sort: { date: DESC }) {
1212
nodes {
1313
id
1414
...BlogPostPreview_post

0 commit comments

Comments
 (0)