Add git commit, improve post metadata wrapping

This commit is contained in:
BBaoVanC 2021-10-09 22:17:24 -05:00
parent 3dfcec2350
commit f3274c67fc
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 26 additions and 17 deletions

View File

@ -29,15 +29,11 @@
margin-top: 5px;
}
.wordcount, .rss-link, .readingtime {
(.date, .wordcount, .readingtime, .gitcommit, .tag) + (.date, .wordcount, .readingtime, .gitcommit, .tag) {
margin-left: 5px;
}
.tags {
margin-top: 5px;
}
.wordcount, .readingtime, .tag {
.post-meta-item {
white-space: nowrap;
}
@ -121,6 +117,12 @@ hr {
border-color: #444;
}
code {
background-color: #282828;
padding: 2px 4px;
border-radius: 5px;
}
* {
box-sizing: border-box;
}

View File

@ -2,7 +2,7 @@
<div class="post-metadata">
{{ if .Date }}
<span class="date">
<span class="post-meta-item date">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
{{ .Date.Format "January 2, 2006" }}
@ -18,26 +18,33 @@
</span>
{{ if .Site.Params.wordcount }}
<span class="wordcount">
<span class="post-meta-item wordcount">
{{ partial "icon.html" "type" }}
{{ .WordCount }} words
</span>
{{ end }}
{{ if .Site.Params.readingtime }}
<span class="readingtime">
<span class="post-meta-item readingtime">
{{ partial "icon.html" "clock" }}
{{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }}
</span>
{{ end }}
<div class="tags">
{{ with .GitInfo }}
<span class="post-meta-item gitcommit">
{{ partial "icon.html" "git-commit" }}
<a href="{{ (printf "%s/commit/%s" $.Site.Params.repoURL .Hash) | absURL }}">
<code>{{ .AbbreviatedHash }}</code>
</a>
</span>
{{ end }}
{{ range (.GetTerms "tags") }}
<span class="tag">
<span class="post-meta-item tag">
{{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>
</div>
{{ end }}