This article shows how to display the last modified date for posts in Hugo’s PaperMod theme.

Environment

  • Windows 11 / Git Bash
  • Hugo v0.164.0 / Standard build compatible
  • PaperMod v8.0 / Latest commit as of writing
$ hugo version
hugo v0.164.0-ce2470e7012b5ab5fc4e10ebe4027e9f8d9e00dc+extended windows/amd64 BuildDate=2026-07-06T16:39:30Z VendorInfo=gohugoio

$ cd themes/PaperMod && git log -1 --oneline
154d006 (HEAD -> master, origin/master, origin/HEAD) style(post-single): adjust padding for details summary element

Setup Steps

1. Add the layout

Copy themes/PaperMod/layouts/_partials/post_meta.html to layouts/_partials/post_meta.html.

2. Add the template for the last modified date

Add the following template to the layout you created.

{{- if not .Date.IsZero -}}
    {{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default ":date_long" site.Params.DateFormat)))) }}
{{- end }}

{{- if not .Lastmod.IsZero -}}
    {{- $dateStr := .Date.Format "2006-01-02" -}}
    {{- $lastmodStr := .Lastmod.Format "2006-01-02" -}}
    
    {{- if ne $dateStr $lastmodStr -}}
        {{- $text := i18n "last_update" $ -}}
        {{- $scratch.Add "meta" (slice (printf "<span title='%s %s'>%s %s</span>" $text (.Lastmod) $text (.Lastmod | time.Format (default ":date_short" site.Params.DateFormat)))) }}
    {{- end }}
{{- end }}

The display rules for the last modified date are as follows.

  • Hide it when the publication date and the last modified date are the same year, month, and day.
  • Automatically switch the label text to match the display language.
  • Show it in a shortened format that combines the label and the date for each language.

3. Add the language files

This site uses Japanese and English, so add two language files.

i18n/en.yaml

- id: last_update
  translation: "Updated"

i18n/ja.yaml

- id: last_update
  translation: "更新"

4. Check the result

Run hugo server to start the development server and check the result.

If it looks like the example in this article, you’re good.