fix(404): 404 for collections to properly get their layout applied

This commit is contained in:
Khinshan Khan
2020-01-26 12:34:48 -05:00
committed by Jean-Philippe Sirois
parent 849bd0be02
commit 8ab5ec1737
2 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -174,9 +174,9 @@ exports.onCreatePage = async ({ page, actions }) => {
const oldPage = { ...page }
page.matchPath = `/archives/*`
deletePage(oldPage)
} else {
page.context.layout = resolveLayout(page.path)
}
page.context.layout = resolveLayout(page.path)
createPage(page)
}
+3 -2
View File
@@ -78,13 +78,14 @@ export const getPossibleCorrections = (
// filter based on distance
// levenshtein distance of x means how 'off' it was
const displayArray = linkArray.filter(
value =>
const displayArray = linkArray.filter(value => {
return (
levenshteinDistance(
search.toLowerCase(),
value.node!.relativePath!.toLowerCase()
) < threshold
)
})
// helpful message if no matches found
const found = displayArray.length === 0 ? "Oops, nothing similar found." : ""