diff --git a/src/config.rs b/src/config.rs index 0b7c2cd..cbd1cf2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -23,6 +23,8 @@ pub struct FileConfig { pub app_name: Option, /// Name of website owner pub name: Option, + /// Fullname of website owner + pub fullname: Option, } impl FileConfig { @@ -58,6 +60,7 @@ impl FileConfig { onion: test(a.onion, d.onion), app_name: test(a.app_name, d.app_name), name: test(a.name, d.name), + fullname: test(a.fullname, d.fullname), } } } diff --git a/src/routes/agreements.rs b/src/routes/agreements.rs index fe84a29..575f725 100644 --- a/src/routes/agreements.rs +++ b/src/routes/agreements.rs @@ -56,7 +56,7 @@ fn build_humanstxt(config: Config) -> String { HumansTemplate { contact: config.fc.mail.unwrap_or_default(), lang: config.fc.lang.unwrap_or_default(), - name: config.fc.name.unwrap_or_default(), + name: config.fc.fullname.unwrap_or_default(), }, Infos::default(), ) diff --git a/src/routes/blog.rs b/src/routes/blog.rs index f981922..076393f 100644 --- a/src/routes/blog.rs +++ b/src/routes/blog.rs @@ -52,7 +52,10 @@ pub fn build_index(config: Config) -> String { }, Infos { page_title: Some("Blog".into()), - page_desc: Some("Liste des posts d'Anri".into()), + page_desc: Some(format!( + "Liste des posts d'{}", + config.fc.name.unwrap_or_default() + )), page_kw: Some(["blog", "blogging"].join(", ")), }, ) @@ -159,14 +162,14 @@ pub async fn page(path: web::Path<(String,)>, config: web::Data) -> impl fn build_post(file: String, config: Config) -> String { let mut post = None; - let infos = get_post(&mut post, file); + let infos = get_post(&mut post, file, config.fc.name.unwrap_or_default()); config .tmpl .render("blog/post.html", BlogPostTemplate { post }, infos) } -fn get_post(post: &mut Option, filename: String) -> Infos { +fn get_post(post: &mut Option, filename: String, name: String) -> Infos { let blog_dir = "data/blog"; let ext = ".md"; @@ -182,7 +185,7 @@ fn get_post(post: &mut Option, filename: String) -> Infos { Infos { page_title: Some(format!("Post: {}", title)), - page_desc: Some("Blog d'Anri".into()), + page_desc: Some(format!("Blog d'{name}")), page_kw: Some(["blog", "blogging", "write", "writing"].join(", ")), } } @@ -212,12 +215,12 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String { } let link_to_site = format!("{}://{}", info.scheme(), info.host()); - let author = if let (Some(mail), Some(name)) = (config.fc.mail, config.fc.name) { + let author = if let (Some(mail), Some(name)) = (config.fc.mail, config.fc.fullname.to_owned()) { Some(format!("{mail} ({name})")) } else { None }; - let title = "Blog d'Anri"; + let title = format!("Blog d'{}", config.fc.name.unwrap_or_default()); let lang = "fr"; let channel = Channel { title: title.to_owned(), @@ -281,7 +284,7 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String { rel: "self".into(), hreflang: Some(lang.into()), mime_type: Some(MIME_TYPE_RSS.into()), - title: Some(title.to_owned()), + title: Some(title), length: None, }], }), diff --git a/src/routes/contrib.rs b/src/routes/contrib.rs index e0d24ba..4f091e6 100644 --- a/src/routes/contrib.rs +++ b/src/routes/contrib.rs @@ -141,7 +141,10 @@ pub async fn build_page(config: Config) -> String { data, Infos { page_title: Some("Mes contributions".into()), - page_desc: Some("Contributions à l'opensource par Anri".into()), + page_desc: Some(format!( + "Contributions à l'opensource par {}", + config.fc.name.unwrap_or_default() + )), page_kw: None, }, ) diff --git a/src/routes/index.rs b/src/routes/index.rs index 7a5f5ae..6e133ca 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -14,7 +14,7 @@ pub fn build_page(config: Config) -> String { "index.html", (), Infos { - page_title: Some("Mylloon".into()), + page_title: config.fc.fullname, page_desc: Some("Page principale".into()), page_kw: None, }, diff --git a/src/routes/networks.rs b/src/routes/networks.rs index 66f6a02..d2161b6 100644 --- a/src/routes/networks.rs +++ b/src/routes/networks.rs @@ -15,7 +15,7 @@ pub fn build_page(config: Config) -> String { (), Infos { page_title: Some("Mes réseaux".into()), - page_desc: Some("Réseaux d'Anri".into()), + page_desc: Some(format!("Réseaux d'{}", config.fc.name.unwrap_or_default())), page_kw: None, }, ) diff --git a/src/routes/portfolio.rs b/src/routes/portfolio.rs index 0e08597..e78d425 100644 --- a/src/routes/portfolio.rs +++ b/src/routes/portfolio.rs @@ -76,7 +76,10 @@ pub fn build_page(config: Config) -> String { }, Infos { page_title: Some("Portfolio".into()), - page_desc: Some("Portfolio d'Anri".into()), + page_desc: Some(format!( + "Portfolio d'{}", + config.fc.name.unwrap_or_default() + )), page_kw: None, }, )