aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blog.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/blog.rs b/src/blog.rs
index 6c190a9..e549fb2 100644
--- a/src/blog.rs
+++ b/src/blog.rs
@@ -21,6 +21,8 @@ struct IndexTemplate {
#[template(path = "post.html")]
struct PostTemplate {
content: String,
+ title: String,
+ date: String
}
pub struct BlogEntry {
@@ -62,7 +64,13 @@ fn get_file_content(path: &str) -> String {
pub fn render_post_page(path: &String) -> String {
- PostTemplate { content: get_file_content(path) }
+ let blog = BlogEntry::new(path);
+
+ PostTemplate {
+ content: get_file_content(path),
+ title: blog.title,
+ date: blog.datetime.format("%Y-%m-%d").to_string()
+ }
.render_once()
.unwrap()
}