Skip to content

Commit

Permalink
Merge pull request #1693 from rsapkf/404-title
Browse files Browse the repository at this point in the history
Add proper title to 404 page
  • Loading branch information
ehuss authored Mar 28, 2022
2 parents 46345b8 + 675c8c3 commit 1f04a62
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ impl HtmlHandlebars {
// Set a dummy path to ensure other paths (e.g. in the TOC) are generated correctly
data_404.insert("path".to_owned(), json!("404.md"));
data_404.insert("content".to_owned(), json!(html_content_404));

let mut title = String::from("Page not found");
if let Some(book_title) = &ctx.config.book.title {
title.push_str(" - ");
title.push_str(book_title);
}
data_404.insert("title".to_owned(), json!(title));
let rendered = handlebars.render("index", &data_404)?;

let rendered =
Expand Down

0 comments on commit 1f04a62

Please sign in to comment.