The code and data behind xeiaso.net
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

src/tmpl: don't show ads on prerelease posts

Signed-off-by: Xe Iaso <me@christine.website>

Xe Iaso 194d9d0f 741fd948

+8 -4
+2 -2
src/tmpl/blog.rs
··· 59 59 html! { 60 60 (post_metadata(post)) 61 61 @if !post.front_matter.skip_ads { 62 - (nag::referer(referer)) 62 + (nag::referer(post, referer)) 63 63 } 64 64 65 65 article { ··· 187 187 (post_metadata(post)) 188 188 189 189 @if !post.front_matter.skip_ads { 190 - (nag::referer(referer)) 190 + (nag::referer(post, referer)) 191 191 } 192 192 193 193 article {
+6 -2
src/tmpl/nag.rs
··· 9 9 } 10 10 11 11 #[cfg(debug_assertions)] 12 - pub fn referer(_: Option<String>) -> Markup { 12 + pub fn referer(_: &Post, _: Option<String>) -> Markup { 13 13 html! { 14 14 .warning { 15 15 "This is a development instance of xesite. Things here are probably unfinished or in drafting. Don't take anything here super seriously. If you want to share this to an online aggregator, please don't. Drafts are not finalized yet for a reason. Please don't be the reason I need to implement more advanced security than just obscurity." ··· 19 19 } 20 20 21 21 #[cfg(not(debug_assertions))] 22 - pub fn referer(referer: Option<String>) -> Markup { 22 + pub fn referer(post: &Post, referer: Option<String>) -> Markup { 23 23 use xesite_templates::conv as xeblog_conv; 24 24 25 25 if referer.is_none() { ··· 27 27 } 28 28 29 29 let referer = referer.unwrap(); 30 + 31 + if Utc::now().date_naive().num_days_from_ce() < post.date.num_days_from_ce() { 32 + return html! {}; 33 + } 30 34 31 35 if HACKER_NEWS.is_match(&referer) { 32 36 return xesite_templates::advertiser_nag(Some(xeblog_conv(