From 54972aa6f0c16662f2095627e75a28044e33088f Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 16 Mar 2021 00:13:01 +0100 Subject: [PATCH] archive fixes --- gatsby-node.js | 8 ++++---- gatsby/createPages.js | 8 +++++--- src/components/molecules/Pagination.module.css | 2 -- src/components/templates/Archive.tsx | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index e7b827a8..046029bd 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -64,7 +64,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => { } archive: allMarkdownRemark( - filter: { fields: { type: { ne: "photo" } } } + filter: { fields: { type: { nin: "photo" } } } ) { edges { node { @@ -95,15 +95,15 @@ exports.createPages = async ({ graphql, actions, reporter }) => { // Generate post pages generatePostPages(createPage, all) - // Generate archive pages - generateArchivePages(createPage, archiveLength) - // Generate photos archive pages generatePhotosPages(createPage, photosLength) // Generate tag pages generateTagPages(createPage, tags) + // Generate archive pages + generateArchivePages(createPage, archiveLength) + // Create manual redirects generateRedirectPages(createRedirect) } diff --git a/gatsby/createPages.js b/gatsby/createPages.js index 4e99dec2..25eb41d7 100644 --- a/gatsby/createPages.js +++ b/gatsby/createPages.js @@ -47,7 +47,7 @@ exports.generatePostPages = (createPage, posts) => { }) } -function generateIndexPages(createPage, length, slug, template) { +function generateIndexPages(createPage, length, slug, template, tag) { const numPages = Math.ceil(length / itemsPerPage) Array.from({ length: numPages }).forEach((_, i) => { @@ -67,7 +67,8 @@ function generateIndexPages(createPage, length, slug, template) { numPages: numPages, currentPageNumber: i + 1, prevPagePath, - nextPagePath + nextPagePath, + ...(tag && { tag }) } }) }) @@ -90,7 +91,8 @@ exports.generateTagPages = (createPage, tags) => { createPage, totalCount, `/archive/${tag}/`, - archiveTemplate + archiveTemplate, + tag ) }) } diff --git a/src/components/molecules/Pagination.module.css b/src/components/molecules/Pagination.module.css index 444245e7..439b0caa 100644 --- a/src/components/molecules/Pagination.module.css +++ b/src/components/molecules/Pagination.module.css @@ -15,7 +15,6 @@ align-items: center; justify-content: center; min-width: 2.5rem; - box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); color: var(--text-color); } @@ -39,5 +38,4 @@ cursor: default; pointer-events: none; color: var(--text-color-dimmed); - background: rgba(255, 255, 255, 0.1); } diff --git a/src/components/templates/Archive.tsx b/src/components/templates/Archive.tsx index e73eb625..69443c3b 100644 --- a/src/components/templates/Archive.tsx +++ b/src/components/templates/Archive.tsx @@ -50,8 +50,8 @@ export const archiveQuery = graphql` query($tag: String, $skip: Int, $limit: Int) { allMarkdownRemark( filter: { + fields: { type: { nin: "photo" } } frontmatter: { tags: { eq: $tag } } - fields: { type: { ne: "photo" } } } sort: { order: DESC, fields: [fields___date] } skip: $skip