Skip to content

Commit 0d9875d

Browse files
Merge pull request #365 from haskellfoundation/404
Add a GitHub Pages 404 page
2 parents 20850e8 + 1d0401a commit 0d9875d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

message-index/404.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: The Haskell Error Index
3+
---
4+
5+
<div id="documentation-pointer">Page not found.</div>
6+
7+
<script>
8+
const messageRe = /^\/messages\/[A-Z]+-[0-9]+/;
9+
if messageRe.test(window.location.pathname) {
10+
document.getElementById("documentation-pointer").innerHTML = "This message is currently undocumented. You can help out by <a href=\"https://github.com/haskellfoundation/error-message-index/issues\">opening an issue</a> or <a href=\"https://github.com/haskellfoundation/error-message-index/pulls\">contributing documentation</a>."
11+
}
12+
</script>

message-index/site.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ main = hakyll $ do
115115
route $ setExtension "html"
116116
compile $ makeItem $ Redirect "/"
117117

118+
match "404.html" $ do
119+
route idRoute
120+
compile $ do
121+
bread <- breadcrumbField ["index.html"]
122+
let ctx = mconcat [constField "title" "Not Found", bread, defaultContext]
123+
getResourceBody
124+
>>= applyAsTemplate ctx
125+
>>= loadAndApplyTemplate "templates/default.html" ctx
126+
>>= relativizeUrls
127+
118128
match "index.html" $
119129
version "nav" $ do
120130
route idRoute

0 commit comments

Comments
 (0)