fix: content_font compatibility
This commit is contained in:
parent
5d1a49ab06
commit
5d4e94575b
1 changed files with 23 additions and 5 deletions
22
src/model.rs
22
src/model.rs
|
@ -477,13 +477,22 @@ impl EntryMetadata {
|
|||
}
|
||||
|
||||
if !self.content_font.is_empty() {
|
||||
let s: Vec<&str> = self.content_font.split(" ").collect();
|
||||
|
||||
output.push_str(&format!(
|
||||
"<link href=\"https://fonts.googleapis.com/css2?family={}&display=swap\" rel=\"stylesheet\">",
|
||||
s[0].replace("_", "+"),
|
||||
));
|
||||
|
||||
if let Some(headings) = s.get(1) {
|
||||
output.push_str(&format!(
|
||||
"<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">
|
||||
<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>
|
||||
<link href=\"https://fonts.googleapis.com/css2?family={}&display=swap\" rel=\"stylesheet\">",
|
||||
self.content_font.replace(" ", "+").replace("_", "+"),
|
||||
headings.replace("_", "+"),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if self.option_disable_search_engine {
|
||||
output.push_str("<meta name=\"robots\" content=\"noindex\">");
|
||||
|
@ -571,10 +580,19 @@ impl EntryMetadata {
|
|||
}
|
||||
|
||||
if !self.content_font.is_empty() {
|
||||
let s: Vec<&str> = self.content_font.split(" ").collect();
|
||||
|
||||
output.push_str(&format!(
|
||||
".container {{ font-family: \"{}\", system-ui; }}",
|
||||
self.content_font.replace("_", " ")
|
||||
s[0].replace("_", " ")
|
||||
));
|
||||
|
||||
if let Some(headings) = s.get(1) {
|
||||
output.push_str(&format!(
|
||||
".container h1, .container h2, .container h3, .container h4, .container h5, .container h6 {{ font-family: \"{}\", system-ui; }}",
|
||||
headings.replace("_", " ")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if self.content_font_weight != 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue