Format date using built-in locale-aware formatting

This commit is contained in:
Luca 2023-03-12 18:20:56 +01:00
parent aba952f0d7
commit 7ebd00c633
2 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,5 @@
baseURL = 'https://kontakt-bamberg.de/' baseURL = 'https://kontakt-bamberg.de/'
defaultContentLanguage = 'de'
languageCode = 'de-de' languageCode = 'de-de'
paginate = 3 paginate = 3
title = 'kontakt Das Kulturprojekt' title = 'kontakt Das Kulturprojekt'

View File

@ -2,10 +2,8 @@
{{ .Content }} {{ .Content }}
<h1 id="aktuelles">Aktuelles</h1> <h1 id="aktuelles">Aktuelles</h1>
{{ $pagination := .Paginate .RegularPages }} {{ $pagination := .Paginate .RegularPages }}
{{ $days := dict "Monday" "Mo" "Tuesday" "Di" "Wednesday" "Mi" "Thursday" "Do" "Friday" "Fr" "Saturday" "Sa" "Sunday" "So" }}
{{ $months := dict "January" "Januar" "February" "Februar" "March" "März" "April" "April" "May" "Mai" "June" "Juni" "July" "Juli" "August" "August" "September" "September" "October" "Oktober" "November" "November" "December" "Dezember" }}
{{ range $pagination.Pages }} {{ range $pagination.Pages }}
<p class="date">{{ index $days (.Date.Format "Monday") }}, {{ .Date.Format "02" }}. {{ index $months (.Date.Format "January") }} {{ .Date.Format "2006" }}</p> <p class="date">{{ .Date | dateFormat "Mon, 02. January 2006" }}</p>
<article class="preview"> <article class="preview">
{{ with .Resources.GetMatch "image.jpg" }} {{ with .Resources.GetMatch "image.jpg" }}
<section class="image"><img alt="{{ .Title }}" src="{{ .RelPermalink }}"></section> <section class="image"><img alt="{{ .Title }}" src="{{ .RelPermalink }}"></section>