forked from CCCHH/ccchh-website
articles are in the past, so sorting them in descending order will result in the most recent being the first item.
94 lines
3.5 KiB
HTML
94 lines
3.5 KiB
HTML
{{ define "main" }}
|
|
<main class="container" aria-role="main">
|
|
<div class="homepage-content">
|
|
{{ .Content }}
|
|
</div>
|
|
|
|
{{- $events := where (.Site.GetPage "blog").Pages ".Params.categories" "event" }}
|
|
{{- $lookback := time.ParseDuration "-6h" }}
|
|
{{- $upcoming := where $events ".Params.date" "ge" (time.Now.Add $lookback) }}
|
|
|
|
{{- $article := where (.Site.GetPage "blog").Pages ".Params.categories" "article" }}
|
|
{{- $articleDisplayTime := time.ParseDuration "-126h" }}
|
|
{{- $articleNew := where $article ".Params.publishDate" "ge" (time.Now.Add $articleDisplayTime) }}
|
|
|
|
{{ if or $upcoming $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 $upcoming.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 }}
|
|
|
|
{{- range $articleNew.ByDate.Reverse }}
|
|
<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" }}
|
|
<div class="section">
|
|
{{- $hdg_id := .Title | lower | safeURL }}
|
|
<h2 id="{{ $hdg_id }}" class="on-hover-trg">{{ .Title }} <a href="#{{ $hdg_id }}" class="on-hover"><i class="fa-solid fa-link small"></i></a></h2>
|
|
{{ .Content -}}
|
|
|
|
{{- $subsec_dir := strings.TrimLeft "home/" .File.Dir }}
|
|
{{- $subsec_glob := printf "%s*.md" (strings.TrimLeft "home/" .File.Dir) }}
|
|
{{- $subsecs := where ($home.Resources.Match $subsec_glob) ".File.LogicalName" "!=" "index.md" }}
|
|
{{- if $subsecs }}
|
|
<div class="flex-grid">
|
|
{{- range $subsecs }}
|
|
{{- $link := .Params.link }}
|
|
<div class="wide">
|
|
{{- if eq $link nil }}
|
|
<h4>{{ .Title }}</h4>
|
|
{{- else }}
|
|
<h4><a href="{{ $link }}">{{ .Title }}</a></h4>
|
|
{{- end }}
|
|
{{- $img_path := printf "%s%s" $subsec_dir .Params.Image }}
|
|
{{- with $home.Resources.Get $img_path }}
|
|
<a href="{{ $link }}"><img class="groups-img" src="{{ .RelPermalink }}"></a>
|
|
{{- end }}
|
|
{{ .Content }}
|
|
</div>
|
|
{{- end }}
|
|
</div>
|
|
{{- end }}
|
|
|
|
{{- with .Params.Resources }}
|
|
<div class="flex-grid">
|
|
{{- range . }}
|
|
{{- $img := $home.Resources.GetMatch (printf "*/%s" .src) }}
|
|
<div class="img-link"><a href="{{ .params.url }}"><img src="{{ $img.RelPermalink }}" class="box-image" alt=""></a></div>
|
|
{{- end }}
|
|
</div>
|
|
{{- end }}
|
|
</div>
|
|
{{ end }}
|
|
|
|
</main>
|
|
{{ end }}
|