diff --git a/gatsby-node.js b/gatsby-node.js index f53c260..8874cbd 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -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) } diff --git a/src/components/404LinkCorrection/index.tsx b/src/components/404LinkCorrection/index.tsx index 2d00eb0..9290b88 100644 --- a/src/components/404LinkCorrection/index.tsx +++ b/src/components/404LinkCorrection/index.tsx @@ -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." : ""