diff --git a/pages/archive/[slug].js b/pages/archive/[slug].js index dfcef1c3..a7bab124 100644 --- a/pages/archive/[slug].js +++ b/pages/archive/[slug].js @@ -85,25 +85,11 @@ const EventPage = (props) => { export default EventPage export const getStaticPaths = async () => { - const countResult = await client.request({ - query: `{ archiveConnection { totalCount } }`, - }) - const totalCount = countResult.data.archiveConnection.totalCount + const length = await client.queries.archiveConnection() + const postCount = length.data.archiveConnection.totalCount - const {data} = await client.request({ - query: ` - query getPaths($count: Float) { - archiveConnection(last: $count, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u") { - edges { - node { - _sys { - filename - } - } - } - } - }`, - variables: {count: totalCount}, + const {data} = await client.queries.archiveConnection({ + last: postCount, }) const paths = data.archiveConnection.edges.map((x) => { diff --git a/pages/archive/events.js b/pages/archive/events.js index d5e96206..75791ab3 100644 --- a/pages/archive/events.js +++ b/pages/archive/events.js @@ -89,7 +89,7 @@ export const getStaticProps = async () => { const {data} = await client.request({ query: ` { - archiveConnection(filter: {categories: {category: {category: {title: {eq: "Event"}}}}}, sort: "published", last:30, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u") { + archiveConnection(filter: {categories: {category: {category: {title: {eq: "Event"}}}}}, sort: "published", last:30) { edges { node { id diff --git a/pages/archive/index.js b/pages/archive/index.js index 8a231075..158bc7fb 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -129,7 +129,7 @@ export const getStaticProps = async () => { query: ` query getContent($eventCount: Float, $endOfWeek: String) { - archiveConnection(filter: {published: {before: $endOfWeek}}, sort: "published", last: $eventCount, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u"){ + archiveConnection(filter: {published: {before: $endOfWeek}}, sort: "published", last: $eventCount){ edges { node { id diff --git a/pages/archive/specialty-shows/[slug].js b/pages/archive/specialty-shows/[slug].js index cdf685d8..49f8d419 100644 --- a/pages/archive/specialty-shows/[slug].js +++ b/pages/archive/specialty-shows/[slug].js @@ -136,7 +136,7 @@ export const getStaticProps = async (ctx) => { const {data} = await client.request({ query: ` query getContent($title: String, $endOfWeek: String) { - archiveConnection(filter: {categories: {category: {category: {title: {eq: $title}}}}, published: {before: $endOfWeek}}, sort: "published", last: 30, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u") { + archiveConnection(filter: {categories: {category: {category: {title: {eq: $title}}}}, published: {before: $endOfWeek}}, sort: "published", last: 100) { edges { node { id diff --git a/pages/archive/specialty-shows/index.js b/pages/archive/specialty-shows/index.js index c2ae9685..2be7ceab 100644 --- a/pages/archive/specialty-shows/index.js +++ b/pages/archive/specialty-shows/index.js @@ -115,7 +115,7 @@ export const getStaticProps = async () => { query: ` query getContent($endOfWeek:String, $eventCount: Float) { - archiveConnection(filter: {categories: {category: {category: {title: {eq: "Specialty Show"}}}}, published: {before: $endOfWeek}}, sort: "published", last:$eventCount, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u") { + archiveConnection(filter: {categories: {category: {category: {title: {eq: "Specialty Show"}}}}, published: {before: $endOfWeek}}, sort: "published", last:$eventCount) { edges { node { id diff --git a/pages/blog/category/[slug].js b/pages/blog/category/[slug].js index 0abdcb90..840e82a2 100644 --- a/pages/blog/category/[slug].js +++ b/pages/blog/category/[slug].js @@ -87,7 +87,7 @@ export const getStaticProps = async (ctx) => { const {data} = await client.request({ query: ` query getContent($title: String) { - blogConnection(filter: {categories: {category: {category: {title: {eq: $title}}}}}, sort: "published", last:30, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u") { + blogConnection(filter: {categories: {category: {category: {title: {eq: $title}}}}}, sort: "published", last:30) { edges { node { id diff --git a/pages/blog/index.js b/pages/blog/index.js index 2e2ef5bd..453766ec 100644 --- a/pages/blog/index.js +++ b/pages/blog/index.js @@ -128,7 +128,7 @@ export const getStaticProps = async () => { query: ` query getContent($postCount: Float) { - blogConnection(sort: "published", last: $postCount, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u"){ + blogConnection(sort: "published", last: $postCount){ edges { node { id diff --git a/pages/index.js b/pages/index.js index e1d1c4c6..afee533a 100644 --- a/pages/index.js +++ b/pages/index.js @@ -94,7 +94,7 @@ export const getStaticProps = async () => { query: ` query getContent($startOfWeek: String, $endOfWeek: String) { - blogConnection(sort: "published", last:6, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u"){ + blogConnection(sort: "published", last:6){ edges { node { id @@ -119,7 +119,7 @@ export const getStaticProps = async () => { } }, - archiveConnection(filter: {published: {after: $startOfWeek, before: $endOfWeek}}, sort: "published", last:30, before: "cG9zdCNkYXRlIzE2NTc4Njg0MDAwMDAjY29udGVudC9wb3N0cy9hbm90aGVyUG9zdC5qc29u") { + archiveConnection(filter: {published: {after: $startOfWeek, before: $endOfWeek}}, sort: "published", last:30) { edges { node { id