From 5f2a48905634e7874946425057dc904dcb6c7d16 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Wed, 21 Jun 2023 23:46:20 +0100 Subject: implement blog --- articles/rot.md | 28 +++++++++++++++ articles/rot/rot.md | 28 --------------- src/error.rs | 1 + src/main.rs | 32 ++++++++++++++++- src/posts/mod.rs | 73 +++++++++++++++++++++++++++++++------- static/style.css | 63 ++++++++++++++++++++++++++++++++ templates/base.html.tera | 4 +-- templates/blog.html.tera | 22 ++++++++++++ templates/blogpost-panel.html.tera | 8 +++++ templates/blogpost.html.tera | 7 ++++ templates/filtertags.html.tera | 7 ++++ 11 files changed, 230 insertions(+), 43 deletions(-) create mode 100644 articles/rot.md delete mode 100644 articles/rot/rot.md create mode 100644 templates/blog.html.tera create mode 100644 templates/blogpost-panel.html.tera create mode 100644 templates/blogpost.html.tera create mode 100644 templates/filtertags.html.tera diff --git a/articles/rot.md b/articles/rot.md new file mode 100644 index 0000000..5af2a8d --- /dev/null +++ b/articles/rot.md @@ -0,0 +1,28 @@ ++++ +title = "rot" +created_at = "2022-04-27T09:48:30+0100" +tags = ["thoughts"] ++++ + +i want to write something about rot. why not? i think it's become my favourite word over the last few months. it's so versatile. + +what is rot? the oxford english dictionary defines rot as well i tried to look it up and i hit a paywall. this is a good representation of rot. it is pure decay. it is horrid yet undeniable. there is no way to tell at a glance at what point it became rot, and whatever it used to be, was surely destined for this end. perhaps it was always rotted to begin with. there is no way of knowing, only that now, at this time, it is surely rot. + +rot in my opinion represents a state of post-cringe, a state of absurdism. how is rot post-cringe? it is something so bad that when you experience it it no longer triggers your cringe response, you simply accept it for what it is. this is most definitely absurd. there is no more meaning to it but rot. there is no interpretation, there is no saving it from this state, it is past the point of no return. + +how can we solve rot? in my opinion there is therefore only one solution: abandonment of that which is rotted. rot is not worth saving, there is no way to salvage it, we must start anew with something better, even if it shall most likely reach the same end. + +the worst kind of rot is that which pretends to not be completely rot, which is propped up by some as being salvageable, or in some cases, perfectly acceptable and maybe even a net positive. some examples of this include: + +- capitalism +- power structures +- money +- ariana grande +- neoliberalism +- software + +it is undeniable these are rotted to the core. + +i hope this aids in you understanding this term. maybe now you see rot in a different light, and that it could help you in making sense of the world. + +— cel diff --git a/articles/rot/rot.md b/articles/rot/rot.md deleted file mode 100644 index 5af2a8d..0000000 --- a/articles/rot/rot.md +++ /dev/null @@ -1,28 +0,0 @@ -+++ -title = "rot" -created_at = "2022-04-27T09:48:30+0100" -tags = ["thoughts"] -+++ - -i want to write something about rot. why not? i think it's become my favourite word over the last few months. it's so versatile. - -what is rot? the oxford english dictionary defines rot as well i tried to look it up and i hit a paywall. this is a good representation of rot. it is pure decay. it is horrid yet undeniable. there is no way to tell at a glance at what point it became rot, and whatever it used to be, was surely destined for this end. perhaps it was always rotted to begin with. there is no way of knowing, only that now, at this time, it is surely rot. - -rot in my opinion represents a state of post-cringe, a state of absurdism. how is rot post-cringe? it is something so bad that when you experience it it no longer triggers your cringe response, you simply accept it for what it is. this is most definitely absurd. there is no more meaning to it but rot. there is no interpretation, there is no saving it from this state, it is past the point of no return. - -how can we solve rot? in my opinion there is therefore only one solution: abandonment of that which is rotted. rot is not worth saving, there is no way to salvage it, we must start anew with something better, even if it shall most likely reach the same end. - -the worst kind of rot is that which pretends to not be completely rot, which is propped up by some as being salvageable, or in some cases, perfectly acceptable and maybe even a net positive. some examples of this include: - -- capitalism -- power structures -- money -- ariana grande -- neoliberalism -- software - -it is undeniable these are rotted to the core. - -i hope this aids in you understanding this term. maybe now you see rot in a different light, and that it could help you in making sense of the world. - -— cel diff --git a/src/error.rs b/src/error.rs index 81cadd1..eb6f6e6 100644 --- a/src/error.rs +++ b/src/error.rs @@ -8,6 +8,7 @@ pub enum BlossomError { Chrono(Status, #[response(ignore)] chrono::ParseError), Io(Status, #[response(ignore)] std::io::Error), Deserialization(Status, #[response(ignore)] toml::de::Error), + NotFound(Status), NoMetadata(Status), Unimplemented(Status), } diff --git a/src/main.rs b/src/main.rs index dd2bd34..c08c2e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,6 +47,36 @@ async fn home(clients: &State) -> Template { ) } +#[get("/blog")] +async fn blog() -> Template { + let mut blogposts = posts::get_blogposts().await.unwrap_or_default(); + let tags = posts::get_tags(&blogposts); + for blogpost in &mut blogposts { + blogpost.render().await; + } + let reverse = "reverse".to_owned(); + Template::render( + "blog", + context! { + reverse, + blogposts, + tags, + }, + ) +} + +#[get("/blog/")] +async fn blogpost(blogpost: &str) -> Result