From 46e6b5fa84b1ec6e08f124c478909ec745562214 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 14 May 2022 20:46:31 +0200 Subject: feat: Add title and date into the post template Now post template has title and created date by defaul. --- content/posts/2020-07-14Friz_box_turned_off_DHCP.html | 1 - .../2021-12-26K8S_private_gitlab_registry_using_podman.html | 1 - src/blog.rs | 10 +++++++++- templates/post.html | 2 ++ 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 @@
-

Friz.box turned off DHCP

If you turned off your DHCP server follow these steps to connect to FritzBox settings.
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 @@

-

K8S private gitlab registry using podman

This is based on 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 @@ <% include!("header.html"); %>

+

<%- title %>

+
created at: <%- date %>
<%- content %>
-- cgit v1.2.3