diff --git a/internal/src/model/data.rs b/internal/src/model/data.rs index b2b50b4..6453bb4 100644 --- a/internal/src/model/data.rs +++ b/internal/src/model/data.rs @@ -1,4 +1,4 @@ -use crate::utils::md_to_html; +use crate::utils::{capitalize, md_to_html}; use log::{debug, info}; use serde::Deserialize; use std::fs; @@ -55,9 +55,14 @@ impl BlogsData { let blogs: Vec = blogs_paths .iter() .map(|blog_path| { - let (id, name) = blog_path + let (id, name_init) = blog_path .split_once("-") .expect("Failed to split filename into id and name"); + let name_formated = name_init.replace("_", " "); + let (name_lower, _) = name_formated + .split_once(".") + .expect("Failed to remove file extension"); + let name = capitalize(name_lower); let fullpath = format!("{}{}", directory, blog_path); info!("markdown loaded: {}", fullpath); @@ -89,11 +94,11 @@ mod test { fn test_blogs_data_from_dir() { // Preparation let test_id = "999"; - let test_name = "test-blog.md"; + let test_name = "Test blog"; let test_body = "# Testing Blog for Unit Test"; let test_body_html = "

Testing Blog for Unit Test

"; - let test_filename = "999-test-blog.md"; - let test_path = "../statics/blogs/999-test-blog.md"; + let test_filename = "999-test_blog.md"; + let test_path = "../statics/blogs/999-test_blog.md"; // Get current directory debug!( diff --git a/internal/src/router.rs b/internal/src/router.rs index 24db045..94ea33f 100644 --- a/internal/src/router.rs +++ b/internal/src/router.rs @@ -8,7 +8,8 @@ use askama::Template; use log::info; pub async fn styles() -> Result { - Ok(NamedFile::open("./statics/styles.css")?) + let styles = NamedFile::open("./statics/styles.css").expect("Failed to render styles.css"); + Ok(styles) } pub async fn profile() -> Result { diff --git a/internal/src/utils.rs b/internal/src/utils.rs index 45c15b3..ea56812 100644 --- a/internal/src/utils.rs +++ b/internal/src/utils.rs @@ -23,3 +23,12 @@ pub fn read_version_manifest() -> Result { let json: VersionData = serde_json::from_reader(reader).expect("Failed to parse version.json"); Ok(json) } + +/// Capitalizes the first character in s. +pub fn capitalize(s: &str) -> String { + let mut c = s.chars(); + match c.next() { + None => String::new(), + Some(f) => f.to_uppercase().collect::() + c.as_str(), + } +} diff --git a/internal/templates/base.html b/internal/templates/base.html index e9b3468..4204392 100644 --- a/internal/templates/base.html +++ b/internal/templates/base.html @@ -42,7 +42,7 @@ LinkedIn - + GitHub
diff --git a/internal/templates/blog.html b/internal/templates/blog.html index 1c6b26e..0ce7f06 100644 --- a/internal/templates/blog.html +++ b/internal/templates/blog.html @@ -4,8 +4,8 @@ {% block description %}"Blog {{id}} - {{name}}"{% endblock %} {% block content %} -

{{id}} - {{name}}

-

{{filename}}

+

{{id}} | {{name}}

+
{{body|safe}} diff --git a/internal/templates/blogs.html b/internal/templates/blogs.html index 6904a84..d611e59 100644 --- a/internal/templates/blogs.html +++ b/internal/templates/blogs.html @@ -5,10 +5,11 @@ {% block content %}

Blogs

- +
{% for blog in blogs %} -

Blog {{blog.id}}

-

{{blog.name}}

+

+ {{blog.id}} | {{blog.name}} +

{% endfor %} {% endblock content %} diff --git a/internal/templates/profile.html b/internal/templates/profile.html index 3efeed1..637c423 100644 --- a/internal/templates/profile.html +++ b/internal/templates/profile.html @@ -8,6 +8,7 @@

Husni Naufal Zuhdi - Site Reliability Engineer

Overview

Hi! I'm a Site Reliability Engineer by job and Software Engineer by passion. I'm comfortable writing code with python, golang, and rust.

+

I love exploring several topics such as Cloud Computing, DevOps, Platform Engineering, Nuclear Science, and Physics Computation.

Work Experiences


@@ -59,7 +60,10 @@

Cloud Computing

Kubernetes

- Manage hundreds of Kubernetes clusters. + Manage hundreds of Kubernetes clusters and create my own cluster. +

@@ -76,30 +80,32 @@

Linux

-

Projects

-
-
-
-

Sapa.AI

-
    -
  • Design microservice architecture to serve simple CURD API and inference ML API
  • -
  • Develop CRUD and ML APIs with flask and tensorflow frameworks
  • -
  • Lead team of 6 people to deliver a violence reporting android app
  • -
-
-
-

Bachelor Thesis

-
    -
  • Design a neutronic fusion reactor simulation with Paramak and OpenMC library
  • -
  • Optimize simulation workflow to run in Cloud-Native environment
  • -
  • Enable multi-cloud environments with GCP and AWS cloud providers to increase simulation efficiency
  • -
-
-
+ + + + + + + + + + + + + + + + + + + + +

Personal Interests


+

Running, Hard Sci-fi and Fantasy, Books, Climbing, Staring

diff --git a/internal/templates/version.html b/internal/templates/version.html index f1c8d4d..1c95f93 100644 --- a/internal/templates/version.html +++ b/internal/templates/version.html @@ -1,13 +1,11 @@ -

{% extends "base.html" %} {% block title %}Husni Blog v{{version}}{% endblock %} {% block description %}"Husni Blog v{{version}}"{% endblock %} {% block content %} -

Husni Blog v{{version}}

-
-

Environment: {{environment}}

-

Githash: {{build_hash}}

-

Build Date: {{build_date}}

+

Husni Blog v{{version}}

+

Environment: {{environment}}

+

Githash: {{build_hash}}

+

Build Date: {{build_date}}

{% endblock content %} diff --git a/statics/blogs/my_favourite_books.md b/statics/blogs/my_favourite_books.md deleted file mode 100644 index 3ecc48e..0000000 --- a/statics/blogs/my_favourite_books.md +++ /dev/null @@ -1,19 +0,0 @@ -# My Favourite Books - -Here I want to share my favourite books I ever read (at least until 2024). I like read books but not really a bookaholic. Hopefully you can find a new books recomendation after read this article. - -## The Rememberance of Earth's Past a.k.a The Three-Body Problem Trilogy - -First time I ever heard about this trilogy was when I scrolling Reddit to find books recomendation. I was looking for a Hard Fiction novel that have a unique story and world-building. I found two candidates at those time, The Stromlight Archive series written by Brandon Sanderson and The Rememberance of Earth's Past written by Liu Cixin. I like RPG games with high fantasy settings so The Stromlight Archive serries should be the most advantageous candidate, but during those time I still pursuing my bachelor degree as Nuclear Engineer and have a deep curiousity about how far we can push science fiction. In the end I bought The Three-Body Problem book from Periplus and don't worry I'm currently reading The Way of Kings (first The Stromlight Archive series book) since I have more spare time to read. - -The Three-Body Problem start slow. Really slow. I had a mind to drop this book because of the pace in the early book. However, after you found the real problem the main character facing there is no turn back. From there you'll be introduced to several concept in physics, mathematic, and computing that interfaced through a VR game. In the end of the book, you'll see how the main enemy of this trilogy doomed humanity with something I never imagined before. The enemy attacking humanity fundamental weapon that without it we can't make a further move to counter the enemy. It's really facinating when I remeber first time read it. Trully rewarding experience. - -The second and third book, The Dark Forest and Death's End took the doomed ending of the first book to the next level. Personally I like the third book most but the second book have several impact in my life personally. I don't want to spoiler you anymore so you can enjoy the mindblowing experience reading this trilogy for the first time. - -## Dune Saga - - - -## Le Petit Prince (The Little Price) - -## The Phoenix Project diff --git a/statics/styles.css b/statics/styles.css index 0f29008..189f04e 100644 --- a/statics/styles.css +++ b/statics/styles.css @@ -55,8 +55,8 @@ } .paragraph { - padding-left: 5px; - padding-right: 5px; + padding-left: 0px; + padding-right: 0px; } .btn {