Add a logo to the HTML template

The logo is placed at the top of the navication sidebar.
This commit is contained in:
Björn Guth 2021-06-24 14:43:07 +02:00
parent a5ec0dac1c
commit b391d933ef
3 changed files with 16 additions and 0 deletions

View File

@ -603,6 +603,10 @@ fn make_data(
"description".to_owned(), "description".to_owned(),
json!(config.book.description.clone().unwrap_or_default()), 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() { if theme.favicon_png.is_some() {
data.insert("favicon_png".to_owned(), json!("favicon.png")); data.insert("favicon_png".to_owned(), json!("favicon.png"));
} }

View File

@ -344,6 +344,13 @@ ul#searchresults span.teaser em {
right: 0; right: 0;
padding: 10px 10px; 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 { .sidebar .sidebar-resize-handle {
position: absolute; position: absolute;
cursor: col-resize; cursor: col-resize;

View File

@ -103,6 +103,11 @@
<nav id="sidebar" class="sidebar" aria-label="Table of contents"> <nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox"> <div class="sidebar-scrollbox">
{{#if book_logo }}
<div class="sidebar-book-logo">
<img src="{{ book_logo }}">
</div>
{{/if}}
{{#toc}}{{/toc}} {{#toc}}{{/toc}}
</div> </div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>