mirror of
https://github.com/kremalicious/blog.git
synced 2024-12-23 01:30:01 +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(
|
archive: allMarkdownRemark(
|
||||||
filter: { fields: { type: { ne: "photo" } } }
|
filter: { fields: { type: { nin: "photo" } } }
|
||||||
) {
|
) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@ -95,15 +95,15 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
|
|||||||
// Generate post pages
|
// Generate post pages
|
||||||
generatePostPages(createPage, all)
|
generatePostPages(createPage, all)
|
||||||
|
|
||||||
// Generate archive pages
|
|
||||||
generateArchivePages(createPage, archiveLength)
|
|
||||||
|
|
||||||
// Generate photos archive pages
|
// Generate photos archive pages
|
||||||
generatePhotosPages(createPage, photosLength)
|
generatePhotosPages(createPage, photosLength)
|
||||||
|
|
||||||
// Generate tag pages
|
// Generate tag pages
|
||||||
generateTagPages(createPage, tags)
|
generateTagPages(createPage, tags)
|
||||||
|
|
||||||
|
// Generate archive pages
|
||||||
|
generateArchivePages(createPage, archiveLength)
|
||||||
|
|
||||||
// Create manual redirects
|
// Create manual redirects
|
||||||
generateRedirectPages(createRedirect)
|
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)
|
const numPages = Math.ceil(length / itemsPerPage)
|
||||||
|
|
||||||
Array.from({ length: numPages }).forEach((_, i) => {
|
Array.from({ length: numPages }).forEach((_, i) => {
|
||||||
@ -67,7 +67,8 @@ function generateIndexPages(createPage, length, slug, template) {
|
|||||||
numPages: numPages,
|
numPages: numPages,
|
||||||
currentPageNumber: i + 1,
|
currentPageNumber: i + 1,
|
||||||
prevPagePath,
|
prevPagePath,
|
||||||
nextPagePath
|
nextPagePath,
|
||||||
|
...(tag && { tag })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -90,7 +91,8 @@ exports.generateTagPages = (createPage, tags) => {
|
|||||||
createPage,
|
createPage,
|
||||||
totalCount,
|
totalCount,
|
||||||
`/archive/${tag}/`,
|
`/archive/${tag}/`,
|
||||||
archiveTemplate
|
archiveTemplate,
|
||||||
|
tag
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 2.5rem;
|
min-width: 2.5rem;
|
||||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
|
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,5 +38,4 @@
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
color: var(--text-color-dimmed);
|
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) {
|
query($tag: String, $skip: Int, $limit: Int) {
|
||||||
allMarkdownRemark(
|
allMarkdownRemark(
|
||||||
filter: {
|
filter: {
|
||||||
|
fields: { type: { nin: "photo" } }
|
||||||
frontmatter: { tags: { eq: $tag } }
|
frontmatter: { tags: { eq: $tag } }
|
||||||
fields: { type: { ne: "photo" } }
|
|
||||||
}
|
}
|
||||||
sort: { order: DESC, fields: [fields___date] }
|
sort: { order: DESC, fields: [fields___date] }
|
||||||
skip: $skip
|
skip: $skip
|
||||||
|
Loading…
Reference in New Issue
Block a user