Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zhaohuabing/hugo-theme-cleanwhite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaohuabing <zhaohuabing@gmail.com>2021-08-28 07:53:05 +0300
committerzhaohuabing <zhaohuabing@gmail.com>2021-08-28 07:53:05 +0300
commitdac688fd5de0f80ffdd91c2cdd369ca34e95b4fa (patch)
tree858cc19bdfc07782edd71f846028c57579998e03 /layouts
parentc0caf445e57bd83ba338d73fa7961d04341b21bc (diff)
support meatadata in posts
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html38
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>