mirror of
https://github.com/jbowdre/virtuallypotato.git
synced 2024-11-21 22:42:19 +00:00
display lastmod date if set and different from original post date
This commit is contained in:
parent
42a1f37803
commit
19314ceff8
2 changed files with 45 additions and 1 deletions
|
@ -12,3 +12,6 @@ other = "Powered by"
|
|||
|
||||
[and]
|
||||
other = "and"
|
||||
|
||||
[updated]
|
||||
other = "Updated"
|
41
layouts/partials/post-meta.html
Normal file
41
layouts/partials/post-meta.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{- $showShare := ne (.Param "showshare") false }}
|
||||
{{- $showDate := ne (.Param "showdate") false }}
|
||||
{{- $postDate := .Date.Format (default "Jan 2, 2006" $.Site.Params.dateFormat) }}
|
||||
{{- $updateDate := .Lastmod.Format (default "Jan 2, 2006" $.Site.Params.dateFormat) }}
|
||||
{{- $showReadTime := ne (.Param "showreadtime") false }}
|
||||
{{- $showPostMeta := or ($showShare) ($showDate) ($showReadTime) (isset .Params "tags") }}
|
||||
{{- $scratch := newScratch }}
|
||||
{{- $scratch.Set "writeSeparator" false }}
|
||||
{{- if $showPostMeta }}
|
||||
<div class="post_meta">
|
||||
{{- end }}
|
||||
{{- if $showDate }}
|
||||
<span>{{ partial "sprite" (dict "icon" "calendar") }}</span>
|
||||
<span class="post_date">
|
||||
{{ $postDate -}}{{- if ne $postDate $updateDate }} ({{ T "updated" }}: {{ $updateDate -}}){{- end }}
|
||||
</span>
|
||||
{{- $scratch.Set "writeSeparator" true }}
|
||||
{{- end }}
|
||||
{{- if $showReadTime }}
|
||||
<span class="post_time">{{ if ($scratch.Get "writeSeparator") }} · {{ end }}{{ T "reading_time" . }}</span>
|
||||
{{- $scratch.Set "writeSeparator" true }}
|
||||
{{- end }}
|
||||
{{- with .Params.tags -}}
|
||||
<span>
|
||||
{{- if ($scratch.Get "writeSeparator") }} · {{ end }}
|
||||
{{- range . }}
|
||||
{{- $tag := urlize . -}}
|
||||
<a href='{{ absLangURL (printf "tags/%s" $tag) }}' title="{{ . }}" class="post_tag button button_translucent">
|
||||
{{- . }}
|
||||
</a>
|
||||
{{- end }}
|
||||
</span>
|
||||
{{- $scratch.Set "writeSeparator" true }}
|
||||
{{- end }}
|
||||
{{- if $showShare }}
|
||||
<span class="page_only">{{ if ($scratch.Get "writeSeparator") }} ·{{ end }}{{ partial "share" . }}</span>
|
||||
{{- $scratch.Set "writeSeparator" true }}
|
||||
{{- end }}
|
||||
{{- if $showPostMeta }}
|
||||
</div>
|
||||
{{- end }}
|
Loading…
Reference in a new issue