Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #184 from SandaruKasa/last-modified
Browse files Browse the repository at this point in the history
`lastMod` support
  • Loading branch information
Mitrichius authored Jun 25, 2023
2 parents 53cbfc5 + b169058 commit f676986
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ lightTheme:

readNext:
other: "Read next"

lastMod:
other: "Last modified:"
3 changes: 3 additions & 0 deletions i18n/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ lightTheme:

readNext:
other: "Читать далее"

lastMod:
other: "Отредактировано:"
12 changes: 11 additions & 1 deletion layouts/partials/post-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit f676986

Please sign in to comment.