From 8c2363d3302fd7cba703e578aabdfc56e56da66f Mon Sep 17 00:00:00 2001 From: Agahnim Date: Tue, 24 Mar 2026 14:32:08 +0100 Subject: [PATCH] global: move home page and add logic for every page --- src/main.rs | 2 +- templates/base.html | 11 ++++++++++- templates/partials/header.html | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index d44bb95..16805bf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ async fn main() { let state = Arc::new(AppState::try_new().await); let app = Router::new() - .route("/", get(home)) + .route("/home", get(home)) .route("/music", get(music)) .nest_service("/static", ServeDir::new("static")) .fallback(notfound) diff --git a/templates/base.html b/templates/base.html index a7159bc..b2f1b8e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -48,12 +48,21 @@ document.querySelectorAll('navbar input[type="radio"]').forEach(radio => { radio.checked = false; }); - if (path === '/') { + if (path === '/home') { const homeRadio = document.getElementById('nav-home'); if (homeRadio) homeRadio.checked = true; } else if (path === '/music') { const musicRadio = document.getElementById('nav-music'); if (musicRadio) musicRadio.checked = true; + } else if (path === "/blog") { + const blogRadio = document.getElementById('nav-blog'); + if (blogRadio) blogRadio.checked = true; + } else if (path === "/about") { + const aboutRadio = document.getElementById('nav-about'); + if (aboutRadio) aboutRadio.checked = true; + } else if (path === "/projects") { + const projectsRadio = document.getElementById('nav-projects'); + if (projectsRadio) projectsRadio.checked = true; } } diff --git a/templates/partials/header.html b/templates/partials/header.html index 79fef1f..6b219da 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -8,10 +8,12 @@ - Home + Home About me + Blog + Projects Music