Skip to content

Commit

Permalink
Install wildcard handler if path includes '/404'
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg committed Mar 7, 2016
1 parent 1e44024 commit f7067f6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/isomorphic/create-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = (files, pagesReq) => {
pages,
templates,
}
let notFound = null
const templatesHash = {}
templatesHash.root = routes
templatesHash['/'] = routes
Expand Down Expand Up @@ -159,7 +160,22 @@ module.exports = (files, pagesReq) => {
parentTemplateFile,
})
}

if (includes(page.path, '/404')) {
notFound = {
path: '*',
component: handler,
page,
pages,
templates,
parentTemplateFile,
}
}
})

if (notFound) {
routes.childRoutes.push(notFound)
}

return routes
}

0 comments on commit f7067f6

Please sign in to comment.