diff --git a/blog/AMindForNumbers.html b/posts/AMindForNumbers.html similarity index 100% rename from blog/AMindForNumbers.html rename to posts/AMindForNumbers.html diff --git a/blog/AskingForHelp.html b/posts/AskingForHelp.html similarity index 100% rename from blog/AskingForHelp.html rename to posts/AskingForHelp.html diff --git a/blog/DeepWork.html b/posts/DeepWork.html similarity index 100% rename from blog/DeepWork.html rename to posts/DeepWork.html diff --git a/blog/DisciplineAndMotivation.html b/posts/DisciplineAndMotivation.html similarity index 100% rename from blog/DisciplineAndMotivation.html rename to posts/DisciplineAndMotivation.html diff --git a/blog/DoingMoreWithMyIdeas.html b/posts/DoingMoreWithMyIdeas.html similarity index 100% rename from blog/DoingMoreWithMyIdeas.html rename to posts/DoingMoreWithMyIdeas.html diff --git a/blog/ExercisingWithoutTime.html b/posts/ExercisingWithoutTime.html similarity index 100% rename from blog/ExercisingWithoutTime.html rename to posts/ExercisingWithoutTime.html diff --git a/blog/FirstStepsToDigitalIndependence.html b/posts/FirstStepsToDigitalIndependence.html similarity index 100% rename from blog/FirstStepsToDigitalIndependence.html rename to posts/FirstStepsToDigitalIndependence.html diff --git a/blog/GraduateSchool.html b/posts/GraduateSchool.html similarity index 100% rename from blog/GraduateSchool.html rename to posts/GraduateSchool.html diff --git a/blog/Habits.html b/posts/Habits.html similarity index 100% rename from blog/Habits.html rename to posts/Habits.html diff --git a/blog/ImmersiveLearningAndExperimentation.html b/posts/ImmersiveLearningAndExperimentation.html similarity index 100% rename from blog/ImmersiveLearningAndExperimentation.html rename to posts/ImmersiveLearningAndExperimentation.html diff --git a/blog/Independence.html b/posts/Independence.html similarity index 100% rename from blog/Independence.html rename to posts/Independence.html diff --git a/blog/LessIsMore.html b/posts/LessIsMore.html similarity index 100% rename from blog/LessIsMore.html rename to posts/LessIsMore.html diff --git a/blog/LevelingTool.html b/posts/LevelingTool.html similarity index 100% rename from blog/LevelingTool.html rename to posts/LevelingTool.html diff --git a/blog/LookingLikeAFool.html b/posts/LookingLikeAFool.html similarity index 100% rename from blog/LookingLikeAFool.html rename to posts/LookingLikeAFool.html diff --git a/blog/MidnightMusings2024-09-26.html b/posts/MidnightMusings2024-09-26.html similarity index 100% rename from blog/MidnightMusings2024-09-26.html rename to posts/MidnightMusings2024-09-26.html diff --git a/blog/PetsWorryAndInformation.html b/posts/PetsWorryAndInformation.html similarity index 100% rename from blog/PetsWorryAndInformation.html rename to posts/PetsWorryAndInformation.html diff --git a/blog/SelfDirectedLearning.html b/posts/SelfDirectedLearning.html similarity index 100% rename from blog/SelfDirectedLearning.html rename to posts/SelfDirectedLearning.html diff --git a/blog/SpeedReadingWorkbook.html b/posts/SpeedReadingWorkbook.html similarity index 100% rename from blog/SpeedReadingWorkbook.html rename to posts/SpeedReadingWorkbook.html diff --git a/blog/TheFoundation.html b/posts/TheFoundation.html similarity index 100% rename from blog/TheFoundation.html rename to posts/TheFoundation.html diff --git a/blog/TheMythOfPerfection.html b/posts/TheMythOfPerfection.html similarity index 100% rename from blog/TheMythOfPerfection.html rename to posts/TheMythOfPerfection.html diff --git a/blog/TheStart.html b/posts/TheStart.html similarity index 100% rename from blog/TheStart.html rename to posts/TheStart.html diff --git a/blog/ThisWebsite.html b/posts/ThisWebsite.html similarity index 97% rename from blog/ThisWebsite.html rename to posts/ThisWebsite.html index c0d805e..7079bc4 100755 --- a/blog/ThisWebsite.html +++ b/posts/ThisWebsite.html @@ -88,7 +88,7 @@ date: 2021-07-05 It is important to take the time to ensure that the things that we create are as simple as possible while still doing everything they need to do. It often makes them harder to make in the first place but the extra investment of time and energy upfront make maintaining and modifying them much simpler. Overall it saves much more time then it takes, but the time saved is spread out over years and is less noticeable. - Kind of like good habits where the cost is now and the rewards are later. + Kind of like good habits where the cost is now and the rewards are later.

diff --git a/blog/WhyAndGettingLost.html b/posts/WhyAndGettingLost.html similarity index 100% rename from blog/WhyAndGettingLost.html rename to posts/WhyAndGettingLost.html diff --git a/blog/Writing.html b/posts/Writing.html similarity index 100% rename from blog/Writing.html rename to posts/Writing.html diff --git a/src/database/article.rs b/src/database/article.rs index 11f17c6..4d92855 100644 --- a/src/database/article.rs +++ b/src/database/article.rs @@ -135,7 +135,7 @@ impl PsqlData for Article { } pub async fn load_articles(pool: &Pool) -> Result<(), Box> { - let paths = fs::read_dir("blog/").unwrap(); + let paths = fs::read_dir("posts/").unwrap(); for path_entry in paths { let path: PathBuf = path_entry.unwrap().path(); let metadata = metadata(path.clone()).unwrap(); diff --git a/src/html/mod.rs b/src/html/mod.rs index 1c3524c..4b08e1a 100644 --- a/src/html/mod.rs +++ b/src/html/mod.rs @@ -1,7 +1,7 @@ use serde::Deserialize; pub mod admin; -pub mod blog; +pub mod posts; pub mod projects; pub mod root; pub mod templates; diff --git a/src/html/blog.rs b/src/html/posts.rs similarity index 86% rename from src/html/blog.rs rename to src/html/posts.rs index 5bc8f3c..f499a5b 100644 --- a/src/html/blog.rs +++ b/src/html/posts.rs @@ -8,22 +8,22 @@ use axum::{ use sqlx::PgPool; use std::{collections::HashMap, error::Error}; -use super::templates::{ArticleTemplate, BlogFooterTemplate, BlogTemplate, HtmlTemplate}; +use super::templates::{ArticleTemplate, PostFooterTemplate, PostTemplate, HtmlTemplate}; pub fn get_router() -> Router { Router::new() - .route("/", get(blog)) + .route("/", get(post)) .route("/:article", get(article)) } -async fn blog(Extension(pool): Extension) -> impl IntoResponse { - let blog_page = BlogTemplate { +async fn post(Extension(pool): Extension) -> impl IntoResponse { + let post_page = PostTemplate { articles: match get_articles_date_sorted(&pool).await { Ok(list) => list, Err(_) => Vec::new(), }, }; - HtmlTemplate(blog_page) + HtmlTemplate(post_page) } async fn article( @@ -35,7 +35,7 @@ async fn article( Ok(a) => *a, Err(_) => return Err(StatusCode::NOT_FOUND), }; - let footer = BlogFooterTemplate { + let footer = PostFooterTemplate { previous: match article.previous { Some(a) => a, None => "".to_string(), diff --git a/src/html/root.rs b/src/html/root.rs index 195f979..d93d7da 100644 --- a/src/html/root.rs +++ b/src/html/root.rs @@ -23,7 +23,7 @@ use crate::{ use super::{ admin, - blog::{self, get_articles_date_sorted}, + posts::{self, get_articles_date_sorted}, projects, templates::{ AboutTemplate, AiTemplate, BlogrollTemplate, BooksTemplate, ContactTemplate, CookingTemplate, CreationTemplate, GiftsTemplate, HomeTemplate, HtmlTemplate, InterestsTemplate, LinksPageTemplate, LoginTemplate, MoneyTemplate, NowTemplate, ResumeTemplate, SignupTemplate, TechnologyTemplate, TimeTemplate, UsesTemplate, WorkTemplate @@ -37,7 +37,7 @@ pub fn get_router(pool: PgPool) -> Router { let middleware_database = pool.clone(); Router::new() - .nest("/blog", blog::get_router()) + .nest("/posts", posts::get_router()) .nest("/projects", projects::get_router()) .nest("/admin", admin::get_router()) .nest_service( diff --git a/src/html/templates.rs b/src/html/templates.rs index b31c069..ce16e75 100644 --- a/src/html/templates.rs +++ b/src/html/templates.rs @@ -49,8 +49,8 @@ pub struct LinksPageTemplate { } #[derive(Template)] -#[template(path = "blog.html")] -pub struct BlogTemplate { +#[template(path = "posts.html")] +pub struct PostTemplate { pub articles: Vec

, } @@ -128,7 +128,7 @@ pub struct CreationTemplate {} #[derive(Template)] #[template(path = "blog_footer.html")] -pub struct BlogFooterTemplate { +pub struct PostFooterTemplate { pub previous: String, pub next: String, } diff --git a/templates/base.html b/templates/base.html index 170243a..bc28eae 100644 --- a/templates/base.html +++ b/templates/base.html @@ -33,7 +33,7 @@
  • - + Posts diff --git a/templates/books.html b/templates/books.html index be79a6d..fd97e41 100755 --- a/templates/books.html +++ b/templates/books.html @@ -55,8 +55,8 @@

    Reflections from Books I have read

    diff --git a/templates/creation.html b/templates/creation.html index 5c8d418..f082dbf 100644 --- a/templates/creation.html +++ b/templates/creation.html @@ -6,7 +6,7 @@

    Creating things is something that my family has always held as something very important. We tend to operate more on the building fixing side of things but there is something sacred in any act of creation. - I wrote about this feeling in Midnight Musings when I was unable to sleep. + I wrote about this feeling in Midnight Musings when I was unable to sleep.

    I dabble. diff --git a/templates/home.html b/templates/home.html index fc54e2a..8b46cf9 100644 --- a/templates/home.html +++ b/templates/home.html @@ -31,16 +31,16 @@

    -

    Blog

    +

    Posts

    - Chronological stuff that I have written. + Chronological stuff that I have written. Not adding to this as much with the focus more on less time sensitive information, but if something is timely then will still be added as a blog post.

    Most Recent Posts


    diff --git a/templates/blog.html b/templates/posts.html similarity index 67% rename from templates/blog.html rename to templates/posts.html index bee3b00..a4d4fc8 100644 --- a/templates/blog.html +++ b/templates/posts.html @@ -4,7 +4,7 @@ {% block content %} {% endblock %}