Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ params:
displayUpdatedDate: true
dateFormat: "January 2, 2006"

# Display the author name of the last modified date
displayUpdatedAuthor: true

# Search
# flexsearch is enabled by default
search:
Expand Down
1 change: 1 addition & 0 deletions i18n/de.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
backToTop: "Nach oben"
by: "von"
changeLanguage: "Sprache ändern"
changeTheme: "Darstellung ändern"
copyCode: "Code kopieren"
Expand Down
1 change: 1 addition & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
backToTop: "Scroll to top"
by: "by"
changeLanguage: "Change language"
changeTheme: "Change theme"
copyCode: "Copy code"
Expand Down
1 change: 1 addition & 0 deletions i18n/es.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
backToTop: "Subir al inicio"
by: "por"
changeLanguage: "Cambiar idioma"
changeTheme: "Cambiar tema"
copyCode: "Copiar código"
Expand Down
1 change: 1 addition & 0 deletions i18n/fr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
backToTop: "Revenir en haut"
by: "par"
changeLanguage: "Changer la langue"
changeTheme: "Thème d'affichage"
copyCode: "Copier le code"
Expand Down
11 changes: 10 additions & 1 deletion layouts/_partials/components/last-updated.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{{- $lastUpdated := (T "lastUpdated") | default "Last updated on" -}}
{{- $by := (T "by") | default "by" -}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be easier to format and translate without using "by" since different languages express authorship differently

For example:
• Last updated on 2025-10-11 • Jane Doe
• Last updated on 2025-10-11 — Jane Doe

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a mix?

For the languages that can handle it, add a translation. For the other ones, just add • or — as the default and show it when no translation is available:

Suggested change
{{- $by := (T "by") | default "by" -}}
{{- $by := (T "by") | default "" -}}

WDYT?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that sounds good.

ideally this should be templated, but we don't have to do it right now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, finally I left the dot because for languages without translation, it was using English as the default, and not the default string as I suggested.

{{- $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></div>
<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 " " $by " " .AuthorName | safeHTML }}
{{- end -}}
{{- end -}}
</div>
{{- else -}}
<div class="hx:mt-16"></div>
{{- end -}}
Expand Down