Allow the date/time format on the single template to be overridden

Example:

```toml
[params]
singleDateFormat = '2 January 2006'
```
This commit is contained in:
Nick Savage 2024-09-02 19:57:55 +01:00
parent b64eb091f4
commit a2e01c16dd

View file

@ -22,7 +22,7 @@
<p class="single-readtime">
{{ with .Date }}
{{ $dateMachine := . | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := . | time.Format ":date_long" }}
{{ $dateHuman := . | time.Format (default ":date_long" $.Site.Params.singleDateFormat) }}
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
{{end}}
@ -88,4 +88,4 @@
</div>
{{ end }}
{{ end }}