From 10346d4621d76c13d40c5240f212ae7c9ac2e776 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 12 Jul 2020 22:16:59 -0400 Subject: [PATCH] initial blog index support --- ...623-0001.md => OVE-20190623-0001.markdown} | 0 ...021-0001.md => OVE-20191021-0001.markdown} | 0 src/handlers/mod.rs | 5 + src/main.rs | 7 +- templates/blogindex.rs.html | 94 +++++++++++++++++++ 5 files changed, 105 insertions(+), 1 deletion(-) rename blog/{OVE-20190623-0001.md => OVE-20190623-0001.markdown} (100%) rename blog/{OVE-20191021-0001.md => OVE-20191021-0001.markdown} (100%) create mode 100644 templates/blogindex.rs.html diff --git a/blog/OVE-20190623-0001.md b/blog/OVE-20190623-0001.markdown similarity index 100% rename from blog/OVE-20190623-0001.md rename to blog/OVE-20190623-0001.markdown diff --git a/blog/OVE-20191021-0001.md b/blog/OVE-20191021-0001.markdown similarity index 100% rename from blog/OVE-20191021-0001.md rename to blog/OVE-20191021-0001.markdown diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index f3bc6b4..85e8bbf 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -30,3 +30,8 @@ pub async fn signalboost(state: Arc) -> Result { pub async fn not_found(path: String) -> Result { Response::builder().html(|o| templates::notfound_html(o, path)) } + +pub async fn blog_index(state: Arc) -> Result { + let state = state.clone(); + Response::builder().html(|o| templates::blogindex_html(o, state.blog.clone())) +} diff --git a/src/main.rs b/src/main.rs index ba5a471..edb1029 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,12 @@ async fn main() -> Result<()> { .and_then(handlers::resume)) .or(warp::path!("signalboost") .and(with_state(state.clone())) - .and_then(handlers::signalboost)); + .and_then(handlers::signalboost)) + .or(warp::path!("blog").and( + warp::path::end() + .and(with_state(state.clone())) + .and_then(handlers::blog_index), + )); let files = warp::path("static") .and(warp::fs::dir("./static")) diff --git a/templates/blogindex.rs.html b/templates/blogindex.rs.html new file mode 100644 index 0000000..1eed018 --- /dev/null +++ b/templates/blogindex.rs.html @@ -0,0 +1,94 @@ +@use crate::post::Post; +@use super::{header_html, footer_html}; + +@(posts: Vec) + +@:header_html(Some("Blog"), None) + +

Blogposts

+ +

If you have a compatible reader, be sure to check out my RSS Feed for automatic updates. Also check out the JSONFeed.

+ +

For a breakdown by post series, see here.

+ +

+

+

+ +
+ +

Other Blogs I Find Interesting

+ + + +

Selected Commentary on These Blogposts

+ +

I Put Words on this Webpage so You Have to Listen to Me Now

+ +

+

+ Top tier satire. Won't be read by anyone who should read it, and will be ignored/laughed at by anyone who does/already agrees.
+ + Literally preaching to the literal choir. +
+ +
+ Hired. +
+ +
+ It’s things like this that make me realize just how bizarre this profession really is. +
+ +
+ Meanwhile, in two weeks the entire Haskell ecosystem will adapt. +
+ +
+ dont read any of the other posts if u dont want to melt ur brain backwards +
+ +
+ but yeah needless to say you've basically written the generic form of basically every time I'm subconsciously annoyed by a software dev social pattern +
+ +
+ Well executed. The only thing this is missing is a truncated y-axis on the graph. +
+ +
+ Why would you do that? Just use jRilkef and call $.flopnax() and it'll automatically flopnax your ropjar. (Marked +240345 by flopnax overflow) +
+ +
+ The comments I am reading in response to the words on the website miss the point completely. It is clear from the words on the web page on the link that the point is different than what people here are saying it is. Did you even read those words on the internet web page, accessed from the link, downloaded and subsequently rendered by your browser of choice? +
+

+ +

TempleOS: 2 - god, the Random Number Generator

+ +

+

+ Thank you very much for this series. +
+ +
+ I think Terry was more right than most of us would dare to admit. Playing with the thought of setting up a fund to build a statue in his honor!! +
+ +
+ I ran the voice of god generator and the first thing it did was call me gay. +
+

+ +@:footer_html()