Improve blog post display
All checks were successful
/ build (push) Successful in 13s

* Add a post date to each post
* Do not show the post date for tours
* Only show posts tagged "current-event" on the home page (hiding 37c3 entries)
* Use a custom template for sorting the summary list by title (instead of the default by date)
This commit is contained in:
Stefan Bethke 2024-11-18 12:21:04 +01:00
commit c06c8603ef
17 changed files with 67 additions and 4 deletions

View file

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html class="nojs" lang="{{ site.LanguageCode | default site.Language.Lang }}" dir="{{ site.Language.LanguageDirection | default "ltr" }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{{ block "title" . }}{{ .Title }} {{ site.Title }}{{ end }}</title>
{{ partial "meta.html" . }}
{{ partialCached "styles.html" . }}
{{ partial "meta_json_ld.html" . }}
{{ partial "scripts.html" . }}
{{ partial "math.html" . }}
{{ partialCached "tracking.html" . }}
{{ if templates.Exists "partials/head.html" -}}
{{ partial "head.html" . }}
{{ end -}}
{{ block "head" . }}{{ end }}
</head>
<body class="{{ if .IsPage }}single-page{{ else }}list-page{{ end }}{{ if .IsHome }} front{{ end }}{{ with $.Param "bodyclass" }} {{ . }}{{ end }}">
<div class="page layout__page{{ if $.Param "sidebar" }} layout__sidebar-second{{ end }}">
<header class="header layout__header">
{{ if $.Param "logo" | default true -}}
<a href="{{ site.Home.RelPermalink }}" title="Home" rel="home" class="header__logo">
<img src="{{ with $.Param "logopath" }}{{ . | relURL }}{{ else }}{{ "images/logo.png" | relURL }}{{ end }}"{{ with $.Param "logowidth" }} width="{{ . }}"{{ end }}{{ with $.Param "logoheight" }} height="{{ . }}"{{ end }} alt="Home" class="header__logo-image">
</a>
{{ end -}}
<div class="header__intro">
<div class="header__intro_headline">{{ .Param "headline" }}</div>
{{ if .Param "intro" }}
<div class="header__intro_text">{{ .Param "intro" }}</div>
{{ end }}
</div>
<div class="region header__region">
{{ if hugo.IsMultilingual }}{{ partial "language-selector.html" . }}{{ end -}}
{{ if $.Param "menuinheader" }}{{ partial "menu.html" . }}{{ end -}}
</div>
</header>
{{ if not ($.Param "menuinheader") }}{{ partial "menu.html" . }}{{ end -}}
{{ if $.Param "mobilemenu" }}{{ partial "mobilemenu.html" . }}{{ end -}}
{{ block "main" . }}{{ end }}
{{ if $.Param "sidebar" }}{{ partial "sidebar.html" . }}{{ end -}}
<footer class="footer layout__footer mt--l">
{{ if templates.Exists "partials/footer.html" -}}
{{ partial "footer.html" . }}
{{ else -}}
{{ if $.Param "feedlinks" }}{{ partial "feedlinks.html" . }}{{ end -}}
<p>{{ with $.Param "copyright" }}{{ . | markdownify }}{{ else }}<span>© {{ site.Title }}</span>{{ end }}</p>
{{ with $.Param "footer" }}<p>{{ . | markdownify }}</p>{{ end }}
{{ if $.Param "poweredby" }}<p>Powered by <a href="https://gohugo.io/">Hugo</a> and the <a href="https://github.com/frjo/hugo-theme-zen">Zen theme</a>.</p>{{ end }}
{{ end -}}
</footer>
{{ if $.Param "cookieconsent" }}{{ partialCached "cookieconsent.html" . }}{{ end -}}
</div>
</body>
</html>

View file

@ -0,0 +1,16 @@
{{ define "main" -}}
<main class="main layout__main">
<header>
<h1 class="title">{{ .Title }}</h1>
</header>
{{ .Content }}
{{ $paginator := .Paginate (.Pages) -}}
{{ range $paginator.Pages.ByTitle -}}
{{ .Render "summary" }}
{{ end -}}
{{ partial "pagination.html" . }}
</main>
{{ end -}}

View file

@ -0,0 +1,12 @@
<article class="list-view{{ with .Section }} list-view--{{ . | urlize }}{{ end }}">
<header>
{{- $postDate := "" }}
{{- if .Param "showPostDate" | default false }}
{{- $postDate = .Params.date.Format .Site.Params.dateFormat }}
{{- end }}
<h2 class="title mt--s{{ if $.Param "submitted" | default false }} mb--xxs{{ end }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a> <span class="title-post-date">{{ $postDate }}</span></h2>
{{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }}
</header>
{{ .Summary }}
</article>