commit f5864fcf41e1b52c78b80c396c73704a7a5ede38
parent 86e28a86bc87a70f1f5c28261dbd4b86d8143459
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Fri, 30 May 2025 09:38:32 +0200
feat: do not show posts dated in the future
Diffstat:
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/assets/css/custom.css b/assets/css/custom.css
@@ -47,8 +47,9 @@ p {
{
opacity: 1.0;
}
-/* duplicated posts */
-*[data-duplicate="true"] {
+/* duplicated and invisible posts */
+*[data-duplicate="true"],
+*[data-invisible="true"] {
display: none;
}
/* Span tables across thw whole width */
diff --git a/scripts/run.sh b/scripts/run.sh
@@ -91,6 +91,18 @@ for date in $dates; do
fi
done
+# mark posts set in future as "invisible"
+printf "Mark future posts as invisible...\n"
+dates=$(grep -e "data-invisible=" $page_file | sed -E -e 's/^.*data-invisible="([^"]+)".*$/\1/g' | uniq)
+now=$(date +%s)
+for date in $dates; do
+ secs=$(date +%s --date "$date")
+ if [ $now -lt $secs ]; then
+ sed -E -e "s/(data-invisible=\")$date(\".*)/\1true\2/" -i $page_file
+ fi
+done
+
+
# mark doubled posts as non-visible
printf "Remove duplicated posts...\n"
post_ids=$(
diff --git a/templates/index.tt b/templates/index.tt
@@ -82,6 +82,7 @@
[% FOREACH entry IN feed.entries %]
<section
data-inactive="[% entry.issued | html %]"
+ data-invisible="[% entry.issued | html %]"
data-duplicate="[% entry.link | url | html %]"
>
<!-- Headline -->