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 /templates | |
| 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 'templates')
| -rw-r--r-- | templates/blogindex.rs.html | 5 | ||||
| -rw-r--r-- | templates/blogpost.rs.html | 8 |
2 files changed, 11 insertions, 2 deletions
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<Post>) @@ -13,8 +14,8 @@ <p> <ul> - @for post in posts { - <li>@post.date.format("%Y-%m-%d") - <a href="/@post.link">@post.front_matter.title</a></li> + @for post in posts.iter().filter(|p| Utc::today().num_days_from_ce() >= p.date.num_days_from_ce()) { + <li>@post.detri() - <a href="/@post.link">@post.front_matter.title</a></li> } </ul> </p> 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 @@ <h1>@post.front_matter.title</h1> +@if Utc::today().num_days_from_ce() < post.date.num_days_from_ce() { +<div class="warning"> + <xeblog-conv name="Mara" mood="hacker">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 <a href="https://patreon.com/cadey">Patreon</a>. It helps me afford the copyeditor that I contract for the technical content I write. + </xeblog-conv> +</div> +} + <small>A @post.read_time_estimate_minutes minute read.</small> @body |
