Skip to content

Commit 3bb55e1

Browse files
committed
Revert "refactor: graphql queries"
This reverts commit d485aa5.
1 parent b4ec286 commit 3bb55e1

File tree

4 files changed

+48
-44
lines changed

4 files changed

+48
-44
lines changed

gatsby-node.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,40 @@ exports.createPages = async ({ graphql, actions }) => {
1111

1212
const result = await graphql(`
1313
{
14-
allGhostPost(sort: {published_at: ASC}) {
15-
edges {
16-
node {
17-
slug
18-
}
19-
}
20-
}
21-
allGhostTag(sort: {name: ASC}) {
22-
edges {
23-
node {
24-
slug
25-
url
26-
postCount
27-
}
28-
}
29-
}
30-
allGhostAuthor(sort: {name: ASC}) {
31-
edges {
32-
node {
33-
slug
34-
url
35-
postCount
36-
}
37-
}
38-
}
39-
allGhostPage(sort: {published_at: ASC}) {
40-
edges {
41-
node {
42-
slug
43-
url
44-
}
45-
}
46-
}
47-
}
14+
allGhostPost(sort: { order: ASC, fields: published_at }) {
15+
edges {
16+
node {
17+
slug
18+
}
19+
}
20+
}
21+
allGhostTag(sort: { order: ASC, fields: name }) {
22+
edges {
23+
node {
24+
slug
25+
url
26+
postCount
27+
}
28+
}
29+
}
30+
allGhostAuthor(sort: { order: ASC, fields: name }) {
31+
edges {
32+
node {
33+
slug
34+
url
35+
postCount
36+
}
37+
}
38+
}
39+
allGhostPage(sort: { order: ASC, fields: published_at }) {
40+
edges {
41+
node {
42+
slug
43+
url
44+
}
45+
}
46+
}
47+
}
4848
`);
4949

5050
// Check for any errors

src/templates/author.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ export default Author;
7171

7272
export const pageQuery = graphql`
7373
query GhostAuthorQuery($slug: String!, $limit: Int!, $skip: Int!) {
74-
ghostAuthor(slug: {eq: $slug}) {
74+
ghostAuthor(slug: { eq: $slug }) {
7575
...GhostAuthorFields
7676
}
7777
allGhostPost(
78-
sort: {published_at: DESC}
79-
filter: {authors: {elemMatch: {slug: {eq: $slug}}}}
78+
sort: { order: DESC, fields: [published_at] }
79+
filter: { authors: { elemMatch: { slug: { eq: $slug } } } }
8080
limit: $limit
8181
skip: $skip
8282
) {

src/templates/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,15 @@ export default Index;
153153
// The `limit` and `skip` values are used for pagination
154154
export const pageQuery = graphql`
155155
query GhostPostQuery($limit: Int!, $skip: Int!) {
156-
allGhostPost(sort: {published_at: DESC}, limit: $limit, skip: $skip) {
156+
allGhostPost(
157+
sort: { order: DESC, fields: [published_at] }
158+
limit: $limit
159+
skip: $skip
160+
) {
157161
edges {
158162
node {
159163
...GhostPostFields
160-
}
164+
}
161165
}
162166
}
163167
}

src/templates/tag.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ const Tag = ({ data, location, pageContext }) => {
1919
<>
2020
<MetaData data={data} location={location} type="series" />
2121
<Layout>
22-
<div>
22+
<div>
2323
<div className=" bg-bg-black py-8 text-white mx-auto">
2424
<div className="prose ml-4 md:mx-auto max-w-3xl">
2525
<h3 className="prose-sm text-white font-light">Catergory</h3>
26-
<h1 className="prose-4xl text-white underline underline-offset-8 capitalize">{tag.name}</h1>
26+
<h1 className="prose-4xl text-white underline underline-offset-8 capitalize">{tag.name}</h1>
2727
</div>
2828
</div>
2929

@@ -68,12 +68,12 @@ export default Tag;
6868

6969
export const pageQuery = graphql`
7070
query GhostTagQuery($slug: String!, $limit: Int!, $skip: Int!) {
71-
ghostTag(slug: {eq: $slug}) {
71+
ghostTag(slug: { eq: $slug }) {
7272
...GhostTagFields
7373
}
7474
allGhostPost(
75-
sort: {published_at: DESC}
76-
filter: {tags: {elemMatch: {slug: {eq: $slug}}}}
75+
sort: { order: DESC, fields: [published_at] }
76+
filter: { tags: { elemMatch: { slug: { eq: $slug } } } }
7777
limit: $limit
7878
skip: $skip
7979
) {

0 commit comments

Comments
 (0)