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

View file

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