diff --git a/src/app/mod.rs b/src/app/mod.rs index a58551e..fe87a88 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,5 +1,6 @@ use crate::{post::Post, signalboost::Person}; use color_eyre::eyre::Result; +use chrono::prelude::*; use serde::Deserialize; use std::{ fs, @@ -91,8 +92,13 @@ pub async fn init(cfg: PathBuf) -> Result { everything.sort(); everything.reverse(); - let everything: Vec = everything.into_iter().take(5).collect(); - + let today = Utc::today(); + let everything: Vec = everything + .into_iter() + .filter(|p| today.num_days_from_ce() >= p.date.num_days_from_ce()) + .take(5) + .collect(); + let mut jfb = jsonfeed::Feed::builder() .title("Xe's Blog") .description("My blog posts and rants about various technology things.") diff --git a/templates/blogindex.rs.html b/templates/blogindex.rs.html index 70fb881..111da9e 100644 --- a/templates/blogindex.rs.html +++ b/templates/blogindex.rs.html @@ -1,5 +1,6 @@ @use crate::post::Post; @use super::{header_html, footer_html}; +@use chrono::prelude::*; @(posts: Vec) @@ -13,8 +14,8 @@

diff --git a/templates/blogpost.rs.html b/templates/blogpost.rs.html index 3b60689..13f8302 100644 --- a/templates/blogpost.rs.html +++ b/templates/blogpost.rs.html @@ -1,5 +1,6 @@ @use super::{header_html, footer_html}; @use crate::post::Post; +@use chrono::prelude::*; @(post: Post, body: impl ToHtml) @@ -62,6 +63,13 @@

@post.front_matter.title

+@if Utc::today().num_days_from_ce() < post.date.num_days_from_ce() { +
+ Hey, this post is set to go live to the public on @post.detri(). Right now you are reading a pre-publication version of this post. Please do not share this on social media. This post will automatically go live for everyone on the intended publication date. If you want access to these posts, please join the Patreon. It helps me afford the copyeditor that I contract for the technical content I write. + +
+} + A @post.read_time_estimate_minutes minute read. @body