diff --git a/src/html/blog.rs b/src/html/blog.rs
index 932f72c..b669a73 100644
--- a/src/html/blog.rs
+++ b/src/html/blog.rs
@@ -1,5 +1,4 @@
use crate::database::data::Article;
-use crate::html;
use askama::Template;
use axum::{
extract::{Extension, Path},
@@ -9,14 +8,27 @@ use axum::{
use core::panic;
use std::collections::HashMap;
-use super::root::AppState;
+use super::{root::AppState, HtmlTemplate, NavBar};
pub fn get_router() -> Router {
Router::new()
- .route("/", get(html::root::blog))
+ .route("/", get(blog))
.route("/:article", get(article))
}
+pub async fn blog() -> impl IntoResponse {
+ let template = BlogTemplate {
+ active_navbar: NavBar::BLOG,
+ };
+ HtmlTemplate(template)
+}
+
+#[derive(Template)]
+#[template(path = "blog.html")]
+struct BlogTemplate {
+ active_navbar: &'static str,
+}
+
#[derive(Template)]
#[template(path = "Article.html")]
struct ArticleTemplate {
@@ -37,7 +49,7 @@ async fn article(
Err(_) => panic!("Not an article at all!!!!"),
};
let template = ArticleTemplate {
- active_navbar: html::NavBar::BLOG,
+ active_navbar: NavBar::BLOG,
content: article.content,
previous: match article.previous {
Some(a) => a,
@@ -48,5 +60,5 @@ async fn article(
None => "".to_string(),
},
};
- html::HtmlTemplate(template)
+ HtmlTemplate(template)
}
diff --git a/src/html/projects.rs b/src/html/projects.rs
index f818c02..fa93c1f 100644
--- a/src/html/projects.rs
+++ b/src/html/projects.rs
@@ -1,21 +1,35 @@
-use crate::html;
use askama::Template;
use axum::response::IntoResponse;
use axum::{routing::get, Router};
+use super::{HtmlTemplate, NavBar};
+
pub fn get_router() -> Router {
Router::new()
- .route("/", get(html::root::projects))
+ .route("/", get(projects))
.route("/archserver", get(archserver))
.route("/tak", get(tak))
.route("/ed", get(ed))
}
+pub async fn projects() -> impl IntoResponse {
+ let template = ProjectsTemplate {
+ active_navbar: NavBar::PROJECTS,
+ };
+ HtmlTemplate(template)
+}
+
+#[derive(Template)]
+#[template(path = "projects.html")]
+struct ProjectsTemplate {
+ active_navbar: &'static str,
+}
+
async fn archserver() -> impl IntoResponse {
let template = ArchServerTemplate {
- active_navbar: html::NavBar::PROJECTS
+ active_navbar: NavBar::PROJECTS
};
- html::HtmlTemplate(template)
+ HtmlTemplate(template)
}
#[derive(Template)]
@@ -26,9 +40,9 @@ struct ArchServerTemplate {
async fn tak() -> impl IntoResponse {
let template = TakTemplate {
- active_navbar: html::NavBar::PROJECTS
+ active_navbar: NavBar::PROJECTS
};
- html::HtmlTemplate(template)
+ HtmlTemplate(template)
}
#[derive(Template)]
@@ -39,9 +53,9 @@ struct TakTemplate {
async fn ed() -> impl IntoResponse {
let template = EdgeDetectionTemplate {
- active_navbar: html::NavBar::PROJECTS
+ active_navbar: NavBar::PROJECTS
};
- html::HtmlTemplate(template)
+ HtmlTemplate(template)
}
#[derive(Template)]
diff --git a/src/html/root.rs b/src/html/root.rs
index bcab1ae..a67c0a0 100644
--- a/src/html/root.rs
+++ b/src/html/root.rs
@@ -48,19 +48,6 @@ struct HomeTemplate {
active_navbar: &'static str,
}
-pub async fn blog() -> impl IntoResponse {
- let template = BlogTemplate {
- active_navbar: NavBar::BLOG,
- };
- HtmlTemplate(template)
-}
-
-#[derive(Template)]
-#[template(path = "blog.html")]
-struct BlogTemplate {
- active_navbar: &'static str,
-}
-
pub async fn projects() -> impl IntoResponse {
let template = ProjectsTemplate {
active_navbar: NavBar::PROJECTS,