diff --git a/src/misc/utils.rs b/src/misc/utils.rs index 162b4e8..e3cdeba 100644 --- a/src/misc/utils.rs +++ b/src/misc/utils.rs @@ -21,3 +21,8 @@ pub fn get_url(fc: FileConfig) -> String { format!("{}://{}", fc.scheme.unwrap(), fc.domain.unwrap()) } + +/// Make a list of keywords +pub fn make_kw(list: &[&str]) -> Option { + Some(list.join(", ")) +} diff --git a/src/routes/blog.rs b/src/routes/blog.rs index 30f8af4..35a7c49 100644 --- a/src/routes/blog.rs +++ b/src/routes/blog.rs @@ -21,7 +21,7 @@ use crate::{ markdown::{ get_metadata, get_options, read_file, File, FileMetadataBlog, TypeFileMetadata, }, - utils::get_url, + utils::{get_url, make_kw}, }, template::{Infos, NavBar}, }; @@ -64,7 +64,7 @@ fn build_index(config: Config) -> String { "Liste des posts d'{}", config.fc.name.unwrap_or_default() )), - page_kw: Some(["blog", "blogging"].join(", ")), + page_kw: make_kw(&["blog", "blogging"]), }, ) } diff --git a/src/template.rs b/src/template.rs index bad8315..7d5f083 100644 --- a/src/template.rs +++ b/src/template.rs @@ -37,14 +37,14 @@ pub struct NavBar { struct Data { /// App name app_name: String, + /// App URL + url: String, /// Title of the page page_title: Option, /// Description of the page page_desc: Option, /// Keywords of the the page page_kw: Option, - /// App URL - url: String, /// Data needed to render the page data: T, } @@ -61,10 +61,10 @@ impl Template { tplt.render(&Data { app_name: self.app_name.to_owned(), + url: add_quotes(self.url.to_owned()), page_title: info.page_title, page_desc: info.page_desc.map(add_quotes), page_kw: info.page_kw.map(add_quotes), - url: add_quotes(self.url.to_owned()), data, }) }