From f6b87947ea3b0b20aacc534f999c3fd6f804588e Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Tue, 20 Apr 2021 16:01:14 -0700 Subject: [PATCH] Render 404 message in view when route not found. --- generator/src/generate-template-module-connector.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/generator/src/generate-template-module-connector.js b/generator/src/generate-template-module-connector.js index be93e98a..5c7e5848 100644 --- a/generator/src/generate-template-module-connector.js +++ b/generator/src/generate-template-module-connector.js @@ -90,7 +90,8 @@ type Msg type PageStaticData - = ${templates + = Data404NotFoundPage____ + | ${templates .map( (name) => `Data${pathNormalizedName(name)} Template.${moduleName( @@ -160,12 +161,10 @@ view page globalData staticData = { head = [] , view = \\_ -> - { title = "Not found" + { title = "Page not found" , body = - Html.pre [] - [ Html.text <| - "Not found - " - ++ String.join "/" (Route.routeToPath page.frontmatter) + Html.div [] + [ Html.text "This page could not be found." ] } @@ -394,7 +393,7 @@ staticDataForRoute : Maybe Route -> DataSource PageStaticData staticDataForRoute route = case route of Nothing -> - DataSource.fail "" + DataSource.succeed Data404NotFoundPage____ ${templates .map( (name) =>