1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 17:23:50 +01:00

archive fixes

This commit is contained in:
Matthias Kretschmann 2021-03-16 00:13:01 +01:00
parent df5e17f116
commit 54972aa6f0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 10 additions and 10 deletions

View File

@ -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)
}

View File

@ -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
)
})
}

View File

@ -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);
}

View File

@ -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