macroblog.rs @ 46e6b5fa84b1ec6e08f124c478909ec745562214

feat: Add title and date into the post template

Now post template has title and created date by defaul.
diff --git a/content/posts/2020-07-14Friz_box_turned_off_DHCP.html b/content/posts/2020-07-14Friz_box_turned_off_DHCP.html
index 569604b4a4169a0eca392de73071f6a436ded7b7..7eb69ef92382e479e9cd75d3ea6358ab7dfaaff9 100644
--- a/content/posts/2020-07-14Friz_box_turned_off_DHCP.html
+++ b/content/posts/2020-07-14Friz_box_turned_off_DHCP.html
@@ -1,5 +1,4 @@
 <section>
-    <h2>Friz.box turned off DHCP</h2>
     <p>
         If you turned off your DHCP server follow these steps to connect to FritzBox settings.
         <br/>
diff --git a/content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html b/content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html
index 43b8245e2fd9b37cb4a1c028241c5313d7ac5ae0..470965c9cb2bdbed6e743a91b0e36e7d2af31f52 100644
--- a/content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html
+++ b/content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html
@@ -1,5 +1,4 @@
 <section>
-    <h2>K8S private gitlab registry using podman</h2>
     <p>
         This is based on <a
             href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/">Log in to
diff --git a/src/blog.rs b/src/blog.rs
index 6c190a9ed1fc5adb26f9929c8bf5ca2f0665136b..e549fb2b5a88dd5de475938f001e493a0ab854e8 100644
--- a/src/blog.rs
+++ b/src/blog.rs
@@ -21,6 +21,8 @@ #[derive(TemplateOnce)]
 #[template(path = "post.html")]
 struct PostTemplate {
     content: String,
+    title: String,
+    date: String
 }
 
 pub struct BlogEntry {
@@ -62,7 +64,13 @@ }
 
 
 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()
 }
diff --git a/templates/post.html b/templates/post.html
index b1f9f72a79252d0610999b6c1c98eaff118c83ae..4e5cf9ad95c1437b78a52453f993571bfff2474d 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -6,6 +6,8 @@ </head>
 <body>
 <% include!("header.html"); %>
 <main class="container">
+    <h2><%- title %></h2>
+    <h5>created at: <%- date %></h2>
     <%- content %>
     </section>
 </main>