mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-06 14:26:35 +03:00
Render 404 message in view when route not found.
This commit is contained in:
parent
45647218a6
commit
f6b87947ea
@ -90,7 +90,8 @@ type Msg
|
|||||||
|
|
||||||
|
|
||||||
type PageStaticData
|
type PageStaticData
|
||||||
= ${templates
|
= Data404NotFoundPage____
|
||||||
|
| ${templates
|
||||||
.map(
|
.map(
|
||||||
(name) =>
|
(name) =>
|
||||||
`Data${pathNormalizedName(name)} Template.${moduleName(
|
`Data${pathNormalizedName(name)} Template.${moduleName(
|
||||||
@ -160,12 +161,10 @@ view page globalData staticData =
|
|||||||
{ head = []
|
{ head = []
|
||||||
, view =
|
, view =
|
||||||
\\_ ->
|
\\_ ->
|
||||||
{ title = "Not found"
|
{ title = "Page not found"
|
||||||
, body =
|
, body =
|
||||||
Html.pre []
|
Html.div []
|
||||||
[ Html.text <|
|
[ Html.text "This page could not be found."
|
||||||
"Not found - "
|
|
||||||
++ String.join "/" (Route.routeToPath page.frontmatter)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +393,7 @@ staticDataForRoute : Maybe Route -> DataSource PageStaticData
|
|||||||
staticDataForRoute route =
|
staticDataForRoute route =
|
||||||
case route of
|
case route of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
DataSource.fail ""
|
DataSource.succeed Data404NotFoundPage____
|
||||||
${templates
|
${templates
|
||||||
.map(
|
.map(
|
||||||
(name) =>
|
(name) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user