summaryrefslogtreecommitdiff
path: root/src/Settlr/Views/ErrorNotFound.hs
blob: d087c5e487ee75f48a0c7aa7df5fd1f60dfd8a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{-# LANGUAGE OverloadedStrings #-}

module Settlr.Views.ErrorNotFound
  ( viewErrorNotFound
  ) where

import Settlr.Config (ScriptM)
import Text.Blaze.Html5 (Html, (!), textValue)
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Settlr.Routes (Route(..), formatRoute)
import Network.CGI (setStatus)

viewErrorNotFound :: ScriptM Html
viewErrorNotFound = do setStatus 404 "Not Found"
                       homePath <- formatRoute RouteHome
                       pure $ H.docTypeHtml $ do
                                H.head $ do
                                  H.title "Not Found"
                                  H.meta ! A.charset "utf-8"
                                H.body $ do
                                  H.h1 "Page Not Found"
                                  H.p "The requested page could not be found"
                                  H.a "Go back home" ! A.href (textValue homePath)