From 666f7be6ce852a8363946f57093173449c933508 Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Mon, 17 Feb 2025 16:51:50 -0600 Subject: [PATCH] feat(blog): Add old article warning (#2897) Signed-off-by: fria <138676274+friadev@users.noreply.github.com> Signed-off-by: Daniel Gray --- theme/blog-post.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/theme/blog-post.html b/theme/blog-post.html index 56f6767e..1caec802 100644 --- a/theme/blog-post.html +++ b/theme/blog-post.html @@ -244,6 +244,26 @@
+ {% set postyear = page.config.date.created.strftime('%s') | int %} + {% set currentyear = build_date_utc.strftime('%s') | int %} + {% set difference = (currentyear / 2628000) - (postyear / 2628000) %} + {% if difference > 18 %} + {% set yearsdifference = ((difference - 1) / 12) | int %} +
+
+

+ This article is more than {{ yearsdifference }} + {% if yearsdifference == 1 %} + year + {% else %} + years + {% endif %} + old +

+
+
+ {% endif %} + {% block content %} {% include "partials/content.html" %} {% endblock %}