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

View File

@ -2,7 +2,7 @@
<div class="post-metadata"> <div class="post-metadata">
{{ if .Date }} {{ if .Date }}
<span class="date"> <span class="post-meta-item date">
{{ partial "icon.html" "calendar" }} {{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate> <time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
{{ .Date.Format "January 2, 2006" }} {{ .Date.Format "January 2, 2006" }}
@ -18,26 +18,33 @@
</span> </span>
{{ if .Site.Params.wordcount }} {{ if .Site.Params.wordcount }}
<span class="wordcount"> <span class="post-meta-item wordcount">
{{ partial "icon.html" "type" }} {{ partial "icon.html" "type" }}
{{ .WordCount }} words {{ .WordCount }} words
</span> </span>
{{ end }} {{ end }}
{{ if .Site.Params.readingtime }} {{ if .Site.Params.readingtime }}
<span class="readingtime"> <span class="post-meta-item readingtime">
{{ partial "icon.html" "clock" }} {{ partial "icon.html" "clock" }}
{{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }} {{ .ReadingTime }} {{ if gt .ReadingTime 1 }} mins {{ else }} min {{ end }}
</span> </span>
{{ end }} {{ 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") }} {{ range (.GetTerms "tags") }}
<span class="tag"> <span class="post-meta-item tag">
{{ partial "icon.html" "tag" }} {{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a> <a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span> </span>
{{ end }} {{ end }}
</div>
</div> </div>
{{ end }} {{ end }}