diff options
author | zhaohuabing <zhaohuabing@gmail.com> | 2021-08-28 07:53:05 +0300 |
---|---|---|
committer | zhaohuabing <zhaohuabing@gmail.com> | 2021-08-28 07:53:05 +0300 |
commit | dac688fd5de0f80ffdd91c2cdd369ca34e95b4fa (patch) | |
tree | 858cc19bdfc07782edd71f846028c57579998e03 /layouts | |
parent | c0caf445e57bd83ba338d73fa7961d04341b21bc (diff) |
support meatadata in posts
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1823d71..7daae46 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -20,21 +20,31 @@ <h1>{{ .Title }}</h1> <h2 class="subheading">{{ .Params.subtitle }}</h2> <span class="meta"> - Posted by - {{ if .Params.author }} - {{ .Params.author }} + {{ if .Params.metadata }} + {{ range $index, $element := .Params.metadata }} + {{ if .link }} + <a href="{{ .link }}">{{ .text }}</a> + {{ else }} + {{ .text }} + {{ end }} + {{ end }} {{ else }} - {{ .Site.Title }} - {{ end }} - on - {{ .Date.Format "Monday, January 2, 2006" }} - {{ if .Site.Params.page_view_conter }} - {{ partial "page_view_counter.html" . }} - {{ end }} - <!-- Don't show "Last Modified on" if update happened on the same day. --> - {{ if (and (not .Lastmod.IsZero) (not (eq (dateFormat "2006-01-02" .Lastmod) (dateFormat "2006-01-02" .Date)))) }} - <br>Last Modified on {{ dateFormat "Monday, January 2, 2006" .Params.LastMod }} - {{ end }} + Posted by + {{ if .Params.author }} + {{ .Params.author }} + {{ else }} + {{ .Site.Title }} + {{ end }} + on + {{ .Date.Format "Monday, January 2, 2006" }} + {{ if .Site.Params.page_view_conter }} + {{ partial "page_view_counter.html" . }} + {{ end }} + <!-- Don't show "Last Modified on" if update happened on the same day. --> + {{ if (and (not .Lastmod.IsZero) (not (eq (dateFormat "2006-01-02" .Lastmod) (dateFormat "2006-01-02" .Date)))) }} + <br>Last Modified on {{ dateFormat "Monday, January 2, 2006" .Params.LastMod }} + {{ end }} + {{ end }} </span> </div> </div> |