Fix favicon when only one is overridden.
A mistake in #1266, I neglected to also update the <link> generation to elide the link if one of the favicon images is not included.
This commit is contained in:
parent
ec495a7823
commit
20a0b99c3d
|
@ -478,7 +478,7 @@ impl Renderer for HtmlHandlebars {
|
||||||
debug!("Register handlebars helpers");
|
debug!("Register handlebars helpers");
|
||||||
self.register_hbs_helpers(&mut handlebars, &html_config);
|
self.register_hbs_helpers(&mut handlebars, &html_config);
|
||||||
|
|
||||||
let mut data = make_data(&ctx.root, &book, &ctx.config, &html_config)?;
|
let mut data = make_data(&ctx.root, &book, &ctx.config, &html_config, &theme)?;
|
||||||
|
|
||||||
// Print version
|
// Print version
|
||||||
let mut print_content = String::new();
|
let mut print_content = String::new();
|
||||||
|
@ -551,6 +551,7 @@ fn make_data(
|
||||||
book: &Book,
|
book: &Book,
|
||||||
config: &Config,
|
config: &Config,
|
||||||
html_config: &HtmlConfig,
|
html_config: &HtmlConfig,
|
||||||
|
theme: &Theme,
|
||||||
) -> Result<serde_json::Map<String, serde_json::Value>> {
|
) -> Result<serde_json::Map<String, serde_json::Value>> {
|
||||||
trace!("make_data");
|
trace!("make_data");
|
||||||
|
|
||||||
|
@ -567,6 +568,12 @@ 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()),
|
||||||
);
|
);
|
||||||
|
if theme.favicon_png.is_some() {
|
||||||
|
data.insert("favicon_png".to_owned(), json!("favicon.png"));
|
||||||
|
}
|
||||||
|
if theme.favicon_svg.is_some() {
|
||||||
|
data.insert("favicon_svg".to_owned(), json!("favicon.svg"));
|
||||||
|
}
|
||||||
if let Some(ref livereload) = html_config.livereload_url {
|
if let Some(ref livereload) = html_config.livereload_url {
|
||||||
data.insert("livereload".to_owned(), json!(livereload));
|
data.insert("livereload".to_owned(), json!(livereload));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,12 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="theme-color" content="#ffffff" />
|
<meta name="theme-color" content="#ffffff" />
|
||||||
|
|
||||||
|
{{#if favicon_svg}}
|
||||||
<link rel="icon" href="{{ path_to_root }}favicon.svg">
|
<link rel="icon" href="{{ path_to_root }}favicon.svg">
|
||||||
|
{{/if}}
|
||||||
|
{{#if favicon_png}}
|
||||||
<link rel="shortcut icon" href="{{ path_to_root }}favicon.png">
|
<link rel="shortcut icon" href="{{ path_to_root }}favicon.png">
|
||||||
|
{{/if}}
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/variables.css">
|
<link rel="stylesheet" href="{{ path_to_root }}css/variables.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/general.css">
|
<link rel="stylesheet" href="{{ path_to_root }}css/general.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/chrome.css">
|
<link rel="stylesheet" href="{{ path_to_root }}css/chrome.css">
|
||||||
|
|
Loading…
Reference in New Issue