Add caching to some partials that don't change much

This commit is contained in:
2021-10-11 09:52:24 -05:00
parent 9ff5314bc0
commit 03834fb1ba
7 changed files with 26 additions and 25 deletions

View File

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