mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-05 23:43:37 +02:00
feat: support graceful 404 pages for resources
This commit is contained in:
committed by
Jean-Philippe Sirois
parent
0c3d8a3b4f
commit
c96fb2eabf
+9
-3
@@ -136,10 +136,16 @@ exports.onCreateNode = async ({ node, getNode, actions }) => {
|
||||
}
|
||||
}
|
||||
|
||||
exports.onCreatePage = ({ page, actions }) => {
|
||||
const { createPage } = actions
|
||||
exports.onCreatePage = async ({ page, actions }) => {
|
||||
const { createPage, deletePage } = actions
|
||||
|
||||
page.context.layout = resolveLayout(page.path)
|
||||
if (page.path.match(/^\/resources\/404/)) {
|
||||
const oldPage = { ...page }
|
||||
page.matchPath = `/resources/*`
|
||||
deletePage(oldPage)
|
||||
} else {
|
||||
page.context.layout = resolveLayout(page.path)
|
||||
}
|
||||
createPage(page)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user