add quotes when possible, trailing space at the end
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
This commit is contained in:
parent
24f46402d8
commit
8d5dc03406
2 changed files with 15 additions and 10 deletions
|
@ -39,6 +39,11 @@ struct Data<T> {
|
||||||
data: T,
|
data: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add quotes around a string
|
||||||
|
fn add_quotes(string: String) -> String {
|
||||||
|
format!("\"{}\"", string)
|
||||||
|
}
|
||||||
|
|
||||||
impl Template {
|
impl Template {
|
||||||
pub fn render<C: Content>(&self, template: &str, data: C, info: Infos) -> String {
|
pub fn render<C: Content>(&self, template: &str, data: C, info: Infos) -> String {
|
||||||
let mut templates: Ramhorns = Ramhorns::lazy(&self.directory).unwrap();
|
let mut templates: Ramhorns = Ramhorns::lazy(&self.directory).unwrap();
|
||||||
|
@ -47,9 +52,9 @@ impl Template {
|
||||||
tplt.render(&Data {
|
tplt.render(&Data {
|
||||||
app_name: self.app_name.to_owned(),
|
app_name: self.app_name.to_owned(),
|
||||||
page_title: info.page_title,
|
page_title: info.page_title,
|
||||||
page_desc: info.page_desc,
|
page_desc: info.page_desc.map(add_quotes),
|
||||||
page_kw: info.page_kw,
|
page_kw: info.page_kw.map(add_quotes),
|
||||||
url: info.url,
|
url: add_quotes(info.url),
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,22 @@
|
||||||
{{#page_title}}
|
{{#page_title}}
|
||||||
<meta name="title" content="{{page_title}} " />
|
<meta name="title" content="{{page_title}} " />
|
||||||
{{/page_title}} {{#page_desc}}
|
{{/page_title}} {{#page_desc}}
|
||||||
<meta name="description" content="{{page_desc}} " />
|
<meta name="description" content="{{&page_desc}}" />
|
||||||
{{/page_desc}} {{#page_kw}}
|
{{/page_desc}} {{#page_kw}}
|
||||||
<meta name="keywords" content="{{page_kw}} " />
|
<meta name="keywords" content="{{&page_kw}}" />
|
||||||
{{/page_kw}}
|
{{/page_kw}}
|
||||||
<meta name="author" content="Mylloon" />
|
<meta name="author" content="Mylloon" />
|
||||||
|
|
||||||
<!-- Open Graph -->
|
<!-- Open Graph -->
|
||||||
<meta property="og:title" content="{{page_title}} " />
|
<meta property="og:title" content="{{page_title}} " />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:description" content="{{&page_desc}}" />
|
||||||
<meta property="og:url" content="{{url}} " />
|
<meta property="og:url" content="{{&url}}" />
|
||||||
<meta property="og:image" content="/icons/apple-touch-icon.png" />
|
<meta property="og:image" content="/icons/apple-touch-icon.png" />
|
||||||
<meta property="og:description" content="{{page_desc}} " />
|
<meta property="og:type" content="website" />
|
||||||
<meta name="theme-color" content="#43B581" />
|
<meta name="theme-color" content="#43B581" />
|
||||||
|
|
||||||
<!-- Twitter -->
|
<!-- Twitter -->
|
||||||
<meta property="twitter:url" content="{{url}} " />
|
|
||||||
<meta property="twitter:title" content="{{page_title}} " />
|
<meta property="twitter:title" content="{{page_title}} " />
|
||||||
<meta property="twitter:description" content="{{page_desc}} " />
|
<meta property="twitter:description" content="{{&page_desc}}" />
|
||||||
|
<meta property="twitter:url" content="{{&url}}" />
|
||||||
<meta property="twitter:image" content="/icons/apple-touch-icon.png" />
|
<meta property="twitter:image" content="/icons/apple-touch-icon.png" />
|
||||||
|
|
Loading…
Reference in a new issue