Show article for 30h after publishDate
All checks were successful
/ build (push) Successful in 19s

This commit is contained in:
chris 2025-07-30 20:56:50 +02:00 committed by lilly
commit e5278afd5d
3 changed files with 30 additions and 3 deletions

View file

@ -164,6 +164,10 @@ body>main {
margin-bottom: 1rem;
}
h1, h2, h3, h4, h5, h6 {
margin: 0.5rem 1rem;
}
p {
margin: 0 1rem;
}

View file

@ -27,6 +27,30 @@
</div>
{{- end }}
{{- $article := where (.Site.GetPage "blog").Pages ".Params.categories" "article" }}
{{- $articleDisplayTime := time.ParseDuration "-30h" }}
{{- $articleNew := where $article ".Params.publishDate" "ge" (time.Now.Add $articleDisplayTime) }}
{{ if $articleNew }}
<div class="announcements">
<h2 id="neuigkeiten" class="on-hover-trg">Neuigkeiten <a href="#neuigkeiten" class="on-hover"><i class="fa-solid fa-link small"></i></a></h2>
{{- range $articleNew.ByDate }}
<div class="announcement">
{{- partial "blog-header.html" (dict "headingLink" true "level" 4 "reduced" true "page" . ) }}
{{- if in .RawContent "<!--more-->" }}
{{ .Summary | safeHTML }}
{{- else }}
<p>{{ .Summary | safeHTML }}</p>
{{- end }}
{{- if .Truncated }}
<p class="ellipsis"><a href="{{ .RelPermalink }}">mehr lesen</a></p>
{{- end }}
</div>
{{- end }}
</div>
{{- end }}
{{- $home := .Site.GetPage "/home" }}
{{- $sections := where ($home.Resources.ByType "page") ".File.LogicalName" "index.md" }}
{{- range sort $sections "File.Path" "asc" }}