Skip to content

Commit 675c8c3

Browse files
committed
Add book title to 404 page title.
1 parent 97cb77b commit 675c8c3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +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-
data_404.insert("title".to_owned(), json!("Page not found"));
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));
174180
let rendered = handlebars.render("index", &data_404)?;
175181

176182
let rendered =

0 commit comments

Comments
 (0)