diff options
| author | Xe Iaso <me@christine.website> | 2022-05-05 14:58:23 +0000 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-05-05 14:58:23 +0000 |
| commit | cd1ce7785a01c6dc087b557fa5094168f3269c1f (patch) | |
| tree | 2fec310e5ac34b1e8a4f5692be481c18a362428d /src | |
| parent | a257536b58d641c24bb8a56d5fb61182b7350b81 (diff) | |
| download | xesite-cd1ce7785a01c6dc087b557fa5094168f3269c1f.tar.xz xesite-cd1ce7785a01c6dc087b557fa5094168f3269c1f.zip | |
add support for pre-publication posts
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/mod.rs | 10 |
1 files changed, 8 insertions, 2 deletions
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<State> { everything.sort(); everything.reverse(); - let everything: Vec<Post> = everything.into_iter().take(5).collect(); - + let today = Utc::today(); + let everything: Vec<Post> = 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.") |
