aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-05-14 20:46:31 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-05-14 20:50:37 +0200
commit46e6b5fa84b1ec6e08f124c478909ec745562214 (patch)
tree699ba761d42c79257b81cd1d01ba3e1da99c106c
parentd279a9137601f66685a6bbf1e4f7db162b06e661 (diff)
downloadmacroblog.rs-46e6b5fa84b1ec6e08f124c478909ec745562214.tar.gz
macroblog.rs-46e6b5fa84b1ec6e08f124c478909ec745562214.tar.bz2
macroblog.rs-46e6b5fa84b1ec6e08f124c478909ec745562214.zip
feat: Add title and date into the post template
Now post template has title and created date by defaul.
-rw-r--r--content/posts/2020-07-14Friz_box_turned_off_DHCP.html1
-rw-r--r--content/posts/2021-12-26K8S_private_gitlab_registry_using_podman.html1
-rw-r--r--src/blog.rs10
-rw-r--r--templates/post.html2
4 files changed, 11 insertions, 3 deletions
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 569604b..7eb69ef 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 43b8245..470965c 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 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()
}
diff --git a/templates/post.html b/templates/post.html
index b1f9f72..4e5cf9a 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -6,6 +6,8 @@
<body>
<% include!("header.html"); %>
<main class="container">
+ <h2><%- title %></h2>
+ <h5>created at: <%- date %></h2>
<%- content %>
</section>
</main>