Update post-metadata to use a partial, and add word count

This commit is contained in:
BBaoVanC 2021-10-09 18:08:27 -05:00
parent 4dc429ce5d
commit c8874736ea
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
4 changed files with 41 additions and 59 deletions

View File

@ -29,8 +29,12 @@
margin-top: 5px;
}
.wordcount {
margin-left: 5px;
}
.tags {
margin-left: 10px;
margin-top: 5px;
}
.tag {

View File

@ -3,35 +3,7 @@
<h1>{{ .Title | markdownify }}</h1>
</div>
{{ if or .Date (.GetTerms "tags") }}
<div class="post-metadata">
{{ if .Date }}
<span class="date">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
{{ .Date.Format "January 2, 2006" }}
</time>
{{ if ne .Lastmod .Date }}
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
(Modified {{ .Lastmod.Format "January 2, 2006" }})
</time>
{{ end }}
{{ end }}
</span>
<span class="tags">
{{ range (.GetTerms "tags") }}
<span class="tag">
{{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</span>
</div>
{{ end }}
{{ partial "post-metadata.html" . }}
{{ if .Params.Toc }}
<div id="table-of-contents">

View File

@ -3,35 +3,7 @@
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</h2>
{{ if or .Date (.GetTerms "tags") }}
<div class="post-metadata">
{{ if .Date }}
<span class="date">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
{{ .Date.Format "January 2, 2006" }}
</time>
{{ if ne .Lastmod .Date }}
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
(Modified {{ .Lastmod.Format "January 2, 2006" }})
</time>
{{ end }}
{{ end }}
</span>
<span class="tags">
{{ range (.GetTerms "tags") }}
<span class="tag">
{{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</span>
</div>
{{ end }}
{{ partial "post-metadata.html" . }}
{{ with .Resources.GetMatch "feature" }}
{{ if eq .MediaType.MainType "image" }}

View File

@ -0,0 +1,34 @@
{{ if or .Date (.GetTerms "tags") }}
<div class="post-metadata">
{{ if .Date }}
<span class="date">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
{{ .Date.Format "January 2, 2006" }}
</time>
{{ if ne .Lastmod .Date }}
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
(Modified {{ .Lastmod.Format "January 2, 2006" }})
</time>
{{ end }}
{{ end }}
</span>
<span class="wordcount">
{{ partial "icon.html" "type" }}
{{ .WordCount }} words
</span>
<div class="tags">
{{ range (.GetTerms "tags") }}
<span class="tag">
{{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>
</div>
{{ end }}