fix descriptions
All checks were successful
ci/woodpecker/push/publish Pipeline was successful

This commit is contained in:
Mylloon 2023-10-24 13:43:08 +02:00
parent 49af05a565
commit 4cb73dce3b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 15 additions and 6 deletions

View file

@ -215,21 +215,30 @@ fn get_post(post: &mut Option<File>, filename: String, name: String) -> (Infos,
TypeFileMetadata::Blog,
);
let default = (&filename, Vec::new(), String::new());
let (title, tags, toc) = match post {
let default = (
&filename,
&format!("Blog d'{name}"),
Vec::new(),
String::new(),
);
let (title, desc, tags, toc) = match post {
Some(data) => (
match &data.metadata.info.blog.as_ref().unwrap().title {
Some(text) => text,
None => default.0,
},
match &data.metadata.info.blog.as_ref().unwrap().description {
Some(desc) => desc,
None => default.1,
},
match &data.metadata.info.blog.as_ref().unwrap().tags {
Some(tags) => tags.clone(),
None => default.1,
None => default.2,
},
match &data.metadata.info.blog.as_ref().unwrap().toc {
// TODO: Generate TOC
Some(true) => String::new(),
_ => default.2,
_ => default.3,
},
),
None => default,
@ -238,7 +247,7 @@ fn get_post(post: &mut Option<File>, filename: String, name: String) -> (Infos,
(
Infos {
page_title: Some(format!("Post: {}", title)),
page_desc: Some(format!("Blog d'{name}")),
page_desc: Some(desc.clone()),
page_kw: make_kw(
&["blog", "blogging", "write", "writing"]
.into_iter()

View file

@ -153,7 +153,7 @@ async fn build_page(config: Config) -> String {
Infos {
page_title: Some("Mes contributions".into()),
page_desc: Some(format!(
"Contributions à l'opensource par {}",
"Contributions d'{} à GitHub",
config.fc.name.unwrap_or_default()
)),
page_kw: make_kw(&[