lastMod support

This commit is contained in:
SandaruKasa 2023-06-07 01:21:31 +03:00
parent 53cbfc5b10
commit b169058e71
No known key found for this signature in database
GPG Key ID: F33E2EE578F57268
3 changed files with 17 additions and 1 deletions

View File

@ -51,3 +51,6 @@ lightTheme:
readNext:
other: "Read next"
lastMod:
other: "Last modified:"

View File

@ -48,3 +48,6 @@ lightTheme:
readNext:
other: "Читать далее"
lastMod:
other: "Отредактировано:"

View File

@ -2,10 +2,20 @@
{{ if .Site.Params.dateFormat }}
{{ $dateFormat = .Site.Params.dateFormat }}
{{ end }}
{{ $machineDateFormat := "2006-01-02" }}
<div class="post-info">
{{ if .Params.date }}
<div class="post-date dt-published"><a class="u-url" href="{{ .RelPermalink }}">{{ .Params.date.Format $dateFormat }}<a/></div>
<div class="post-date dt-published">
<a class="u-url" href="{{ .RelPermalink }}"><time datetime="{{ .Params.date.Format $machineDateFormat }}">
{{- .Params.date.Format $dateFormat -}}
</time></a>
{{ if ne .Params.date .Params.lastMod -}}
[{{ i18n "lastMod" }} <time datetime="{{ .Params.lastMod.Format $machineDateFormat }}">
{{- .Params.lastMod.Format $dateFormat -}}
</time>]
{{- end }}
</div>
{{ end }}
<a class="post-hidden-url u-url" href="{{ .Permalink }}">{{ .Permalink }}</a>