Skip to content

Commit 1f04a62

Browse files
authored
Merge pull request #1693 from rsapkf/404-title
Add proper title to 404 page
2 parents 46345b8 + 675c8c3 commit 1f04a62

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ impl HtmlHandlebars {
170170
// Set a dummy path to ensure other paths (e.g. in the TOC) are generated correctly
171171
data_404.insert("path".to_owned(), json!("404.md"));
172172
data_404.insert("content".to_owned(), json!(html_content_404));
173+
174+
let mut title = String::from("Page not found");
175+
if let Some(book_title) = &ctx.config.book.title {
176+
title.push_str(" - ");
177+
title.push_str(book_title);
178+
}
179+
data_404.insert("title".to_owned(), json!(title));
173180
let rendered = handlebars.render("index", &data_404)?;
174181

175182
let rendered =

0 commit comments

Comments
 (0)