parent
dba37137ff
commit
f1aef623b6
@ -29,6 +29,7 @@ func WikiPage(c echo.Context) error {
|
|||||||
// If record not found, show 404
|
// If record not found, show 404
|
||||||
if err.Error() == "record not found" {
|
if err.Error() == "record not found" {
|
||||||
return c.Render(http.StatusOK, "notfound.html", map[string]interface{}{
|
return c.Render(http.StatusOK, "notfound.html", map[string]interface{}{
|
||||||
|
return c.Render(http.StatusNotFound, "404.html", map[string]interface{}{
|
||||||
"name": page_id,
|
"name": page_id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ func Serve() {
|
|||||||
templates["edit.html"] = template.Must(template.ParseFiles("views/edit.html", "views/base.html"))
|
templates["edit.html"] = template.Must(template.ParseFiles("views/edit.html", "views/base.html"))
|
||||||
templates["about.html"] = template.Must(template.ParseFiles("views/about.html", "views/base.html"))
|
templates["about.html"] = template.Must(template.ParseFiles("views/about.html", "views/base.html"))
|
||||||
templates["notfound.html"] = template.Must(template.ParseFiles("views/notfound.html", "views/base.html"))
|
templates["notfound.html"] = template.Must(template.ParseFiles("views/notfound.html", "views/base.html"))
|
||||||
|
templates["404.html"] = template.Must(template.ParseFiles("views/404.html", "views/base.html"))
|
||||||
e.Renderer = &TemplateRegistry{
|
e.Renderer = &TemplateRegistry{
|
||||||
templates: templates,
|
templates: templates,
|
||||||
}
|
}
|
||||||
|
8
views/404.html
Normal file
8
views/404.html
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{{define "title"}}
|
||||||
|
Wikingo | {{index . "name"}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{define "body"}}
|
||||||
|
<h1>404</h1>
|
||||||
|
<h2>Page not found</h2>
|
||||||
|
{{end}}
|
Loading…
Reference in New Issue
Block a user