This commit is contained in:
parent
cc0d787328
commit
76a79bf192
3 changed files with 7 additions and 3 deletions
|
@ -13,6 +13,7 @@ pub struct FileMetadata {
|
|||
pub title: Option<String>,
|
||||
pub link: Option<String>,
|
||||
pub date: Option<Date>,
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Content)]
|
||||
|
|
|
@ -51,6 +51,7 @@ struct Post {
|
|||
title: String,
|
||||
date: Date,
|
||||
url: String,
|
||||
desc: Option<String>,
|
||||
}
|
||||
|
||||
fn get_posts(location: &str) -> Vec<Post> {
|
||||
|
@ -86,8 +87,7 @@ fn get_posts(location: &str) -> Vec<Post> {
|
|||
}
|
||||
Err(_) => FileMetadata {
|
||||
title: Some(file_without_ext.to_owned()),
|
||||
link: None,
|
||||
date: None,
|
||||
..FileMetadata::default()
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -107,6 +107,7 @@ fn get_posts(location: &str) -> Vec<Post> {
|
|||
year: date.year(),
|
||||
}
|
||||
}),
|
||||
desc: file_metadata.description,
|
||||
}
|
||||
})
|
||||
.collect::<Vec<Post>>()
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
>
|
||||
<div class="content">
|
||||
<h3><a href="/blog/{{url}}">{{title}}</a></h3>
|
||||
<p>SHORT DESC</p>
|
||||
{{#desc}}
|
||||
<p>{{desc}}</p>
|
||||
{{/desc}}
|
||||
</div>
|
||||
</li>
|
||||
{{/posts}}
|
||||
|
|
Loading…
Reference in a new issue