From b391d933efed55c2475f9e1b9b938e816fcbcd3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Guth?= Date: Thu, 24 Jun 2021 14:43:07 +0200 Subject: [PATCH] Add a logo to the HTML template The logo is placed at the top of the navication sidebar. --- src/renderer/html_handlebars/hbs_renderer.rs | 4 ++++ src/theme/css/chrome.css | 7 +++++++ src/theme/index.hbs | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 80b06bf8..bc5e7d07 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -603,6 +603,10 @@ fn make_data( "description".to_owned(), json!(config.book.description.clone().unwrap_or_default()), ); + data.insert( + "book_logo".to_owned(), + json!(config.book.logo.clone().unwrap_or_default()), + ); if theme.favicon_png.is_some() { data.insert("favicon_png".to_owned(), json!("favicon.png")); } diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 21c08b93..2f8822ff 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -344,6 +344,13 @@ ul#searchresults span.teaser em { right: 0; padding: 10px 10px; } +.sidebar .sidebar-scrollbox .sidebar-book-logo img { + display: block; + margin-left: auto; + margin-right: auto; + width: 100%; + max-width: max-content; +} .sidebar .sidebar-resize-handle { position: absolute; cursor: col-resize; diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 966eedbc..24c4c13a 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -103,6 +103,11 @@