From cb2948cfc230bd2be2158cf1a695998f96129294 Mon Sep 17 00:00:00 2001 From: Julien WITTOUCK Date: Fri, 30 May 2025 11:07:44 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20:=20add=20warning=20on=20old=20post?= =?UTF-8?q?s=20(>=202=20years)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/custom.css | 27 +++++++++++++++++++++++++++ i18n/en.yml | 2 ++ i18n/fr.yml | 2 ++ layouts/_default/single.html | 13 +++++++++++++ 4 files changed, 44 insertions(+) diff --git a/assets/css/custom.css b/assets/css/custom.css index 0f28edb..f4c69b9 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -218,3 +218,30 @@ blockquote p { position: relative; z-index: 1; } + +/* Alert blockquotes */ +blockquote.alert { + padding: 0; + background-color: white; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); +} +blockquote.alert::before{ + content:""; +} +blockquote.alert-warning { + border-color: #cb8e38; +} +.alert > .alert-heading { + padding: 1rem 1rem 0.5rem 1rem; + margin: 0; + font-weight: bolder; + color: #cb8e38; +} +.alert > .alert-content { + padding: 1rem 1rem 0.5rem 1rem; + margin: 0; + color: black; +} +.alert-warning > .alert-heading { + background-color: #fbf4ea; +} diff --git a/i18n/en.yml b/i18n/en.yml index b713328..57273c7 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -11,6 +11,8 @@ series-other: 'Other posts in this series: ' translations: Translations +old-post: This article was written more than two years ago. It may be obsolete. + previous: « Previous next: Next » diff --git a/i18n/fr.yml b/i18n/fr.yml index b84cf67..a5112eb 100644 --- a/i18n/fr.yml +++ b/i18n/fr.yml @@ -11,6 +11,8 @@ series-other: "Autres posts de cette série : " translations: Traductions +old-post: Cet article a été rédigé il y a plus de deux ans. Il est peut-être obsolète. + previous: « Précédent next: Suivant » diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d8ebb8c..2148462 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,6 +4,19 @@ {{ partial "post/i18nlist.html" . }} + {{ $postDate := .Date }} + {{ $twoYearsAgo := now.AddDate -2 0 0 }} + {{ if lt $postDate $twoYearsAgo }} +
+

+ ⚠️ Warning +

+

+ {{ i18n "old-post" }} +

+
+ {{ end }} + {{ with .Resources }} {{ with .GetMatch "{cover.*}" }} {{ $cover := .Resize "820x" }} -- knotmirror 0.0.1