mirror of
https://github.com/kremalicious/blog.git
synced 2024-12-22 17:23:50 +01:00
archive fixes
This commit is contained in:
parent
df5e17f116
commit
54972aa6f0
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user