use of name and fullname
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
c3e89a061d
commit
503173f129
7 changed files with 24 additions and 12 deletions
|
@ -23,6 +23,8 @@ pub struct FileConfig {
|
|||
pub app_name: Option<String>,
|
||||
/// Name of website owner
|
||||
pub name: Option<String>,
|
||||
/// Fullname of website owner
|
||||
pub fullname: Option<String>,
|
||||
}
|
||||
|
||||
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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
)
|
||||
|
|
|
@ -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<Config>) -> 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<File>, filename: String) -> Infos {
|
||||
fn get_post(post: &mut Option<File>, filename: String, name: String) -> Infos {
|
||||
let blog_dir = "data/blog";
|
||||
let ext = ".md";
|
||||
|
||||
|
@ -182,7 +185,7 @@ fn get_post(post: &mut Option<File>, 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,
|
||||
}],
|
||||
}),
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue