Browse Source

use correct title for error page too

master
Adrian Malacoda 1 year ago
parent
commit
0f3770157d
2 changed files with 5 additions and 3 deletions
  1. + 3
    - 3
      res/error.html.hbs
  2. + 2
    - 0
      src/pages/mod.rs

+ 3
- 3
res/error.html.hbs

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Project Badger Who Server</title>
<title>{{status}} - {{title}}</title>
<link rel="stylesheet" type="text/css" href="index.css" media="all" />
</head>
<body>
@ -9,8 +9,8 @@
<div class="error-message">
<div class="hero-body">
<div class="container">
<h1>{{ status }}</h1>
<h2>{{ message }}</h2>
<h1>{{status}}</h1>
<h2>{{message}}</h2>
</div>
</div>
</div>

+ 2
- 0
src/pages/mod.rs

@ -212,12 +212,14 @@ fn handle_error(request: &Request, status: i64, message: &str) -> Content
let handlebars = request
.guard::<State<Handlebars>>()
.expect("Expected handlebars reference");
let config = request.guard::<State<Config>>().expect("Expected config");
Content(
ContentType::HTML,
handlebars
.render(
"error",
&json!({
"title": config.title.as_ref().map(|title| &**title).unwrap_or_else(|| DEFAULT_TITLE),
"page": "error",
"status": status,
"message": message

Loading…
Cancel
Save