add dateFmt option to single and summary views

This commit is contained in:
colorchestra 2020-08-04 13:33:15 +02:00
parent 730ddd9a1f
commit 41db6a77dc
3 changed files with 8 additions and 3 deletions

View file

@ -30,9 +30,14 @@ Next, open `config.toml` in the base of the Hugo site and ensure the theme optio
theme = "smol"
```
Lastly, add the following lines to your `config.toml` to make use of all the menu entries in the header and footer sections if you need them.
Lastly, add the following lines to your `config.toml` to set site parameters and make use of all the menu entries in the header and footer sections if you need them.
```
# Parameters
[params]
subtitle = "Your blog subtitle goes here!"
dateFmt = "02.01.2006 15:04"
# Header
[menu]
[[menu.main]]

View file

@ -2,7 +2,7 @@
<main>
<article>
<h1>{{ .Title }}</h1>
<b><time>{{ .Date.Format "02.01.2006 15:04" }}</time></b>
<b><time>{{ .Date.Format (default "2006-01-02 15:04:05" .Site.Params.dateFmt) }}</time></b>
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}

View file

@ -1,6 +1,6 @@
<article>
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
<b><time>{{ .Date.Format "02.01.2006 15:04" }}</time></b>
<b><time>{{ .Date.Format (default "2006-01-02 15:04:05" .Site.Params.dateFmt) }}</time></b>
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}