mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
fix(404): 404 for collections to properly get their layout applied
This commit is contained in:
committed by
Jean-Philippe Sirois
parent
849bd0be02
commit
8ab5ec1737
+2
-2
@@ -174,9 +174,9 @@ exports.onCreatePage = async ({ page, actions }) => {
|
|||||||
const oldPage = { ...page }
|
const oldPage = { ...page }
|
||||||
page.matchPath = `/archives/*`
|
page.matchPath = `/archives/*`
|
||||||
deletePage(oldPage)
|
deletePage(oldPage)
|
||||||
} else {
|
|
||||||
page.context.layout = resolveLayout(page.path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page.context.layout = resolveLayout(page.path)
|
||||||
createPage(page)
|
createPage(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,13 +78,14 @@ export const getPossibleCorrections = (
|
|||||||
|
|
||||||
// filter based on distance
|
// filter based on distance
|
||||||
// levenshtein distance of x means how 'off' it was
|
// levenshtein distance of x means how 'off' it was
|
||||||
const displayArray = linkArray.filter(
|
const displayArray = linkArray.filter(value => {
|
||||||
value =>
|
return (
|
||||||
levenshteinDistance(
|
levenshteinDistance(
|
||||||
search.toLowerCase(),
|
search.toLowerCase(),
|
||||||
value.node!.relativePath!.toLowerCase()
|
value.node!.relativePath!.toLowerCase()
|
||||||
) < threshold
|
) < threshold
|
||||||
)
|
)
|
||||||
|
})
|
||||||
|
|
||||||
// helpful message if no matches found
|
// helpful message if no matches found
|
||||||
const found = displayArray.length === 0 ? "Oops, nothing similar found." : ""
|
const found = displayArray.length === 0 ? "Oops, nothing similar found." : ""
|
||||||
|
|||||||
Reference in New Issue
Block a user