Files
hextra/layouts/_partials/components/last-updated.html
Daniel Seijo 9362f7c3fc feat(lastUpdated): introduce last modified author using GitInfo (#857)
* feat(lastUpdated): introduce last modified author using GitInfo

* feat: change by string for just •

* docs: add documentation for displayUpdatedAuthor parameter

Document the new displayUpdatedAuthor config option in all language
versions (en, zh-cn, ja, fa). Also disable it by default in the
example hugo.yaml.

---------

Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
Co-authored-by: Xin <xin@imfing.com>
2026-02-01 15:02:15 +00:00

21 lines
757 B
HTML

{{- $lastUpdated := (T "lastUpdated") | default "Last updated on" -}}
{{- $page := . -}}
{{- if site.Params.displayUpdatedDate -}}
{{- with .Lastmod -}}
{{ $datetime := (time.Format "2006-01-02T15:04:05.000Z" .) }}
<div class="hx:mt-12 hx:mb-8 hx:block hx:text-xs hx:text-gray-500 hx:ltr:text-right hx:rtl:text-left hx:dark:text-gray-400">
{{ $lastUpdated }} <time datetime="{{ $datetime }}">{{ partial "utils/format-date" . }}</time>
{{- if site.Params.displayUpdatedAuthor -}}
{{- with $page.GitInfo -}}
{{ print " • " .AuthorName | safeHTML }}
{{- end -}}
{{- end -}}
</div>
{{- else -}}
<div class="hx:mt-16"></div>
{{- end -}}
{{- else -}}
<div class="hx:mt-16"></div>
{{- end -}}