Add description
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-04-24 18:41:40 +02:00
parent cc0d787328
commit 76a79bf192
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 7 additions and 3 deletions

View file

@ -13,6 +13,7 @@ pub struct FileMetadata {
pub title: Option<String>, pub title: Option<String>,
pub link: Option<String>, pub link: Option<String>,
pub date: Option<Date>, pub date: Option<Date>,
pub description: Option<String>,
} }
#[derive(Content)] #[derive(Content)]

View file

@ -51,6 +51,7 @@ struct Post {
title: String, title: String,
date: Date, date: Date,
url: String, url: String,
desc: Option<String>,
} }
fn get_posts(location: &str) -> Vec<Post> { fn get_posts(location: &str) -> Vec<Post> {
@ -86,8 +87,7 @@ fn get_posts(location: &str) -> Vec<Post> {
} }
Err(_) => FileMetadata { Err(_) => FileMetadata {
title: Some(file_without_ext.to_owned()), title: Some(file_without_ext.to_owned()),
link: None, ..FileMetadata::default()
date: None,
}, },
}; };
@ -107,6 +107,7 @@ fn get_posts(location: &str) -> Vec<Post> {
year: date.year(), year: date.year(),
} }
}), }),
desc: file_metadata.description,
} }
}) })
.collect::<Vec<Post>>() .collect::<Vec<Post>>()

View file

@ -34,7 +34,9 @@
> >
<div class="content"> <div class="content">
<h3><a href="/blog/{{url}}">{{title}}</a></h3> <h3><a href="/blog/{{url}}">{{title}}</a></h3>
<p>SHORT DESC</p> {{#desc}}
<p>{{desc}}</p>
{{/desc}}
</div> </div>
</li> </li>
{{/posts}} {{/posts}}