diff --git a/docs/content/docs/guide/configuration.fa.md b/docs/content/docs/guide/configuration.fa.md index 8a13a64..67e9bb0 100644 --- a/docs/content/docs/guide/configuration.fa.md +++ b/docs/content/docs/guide/configuration.fa.md @@ -285,6 +285,8 @@ params: برای سفارشی کردن فرمت تاریخ، پارامتر `params.dateFormat` را تنظیم کنید. چیدمان آن با [`time.Format`](https://gohugo.io/functions/time/format/) Hugo مطابقت دارد. +علاوه بر این، می‌توانید با فعال کردن پرچم `params.displayUpdatedAuthor` نویسنده آخرین تغییر را نمایش دهید. این نیاز به تنظیم `enableGitInfo: true` دارد. + ```yaml {filename="hugo.yaml"} # تجزیه commit Git enableGitInfo: true @@ -293,6 +295,8 @@ params: # نمایش تاریخ آخرین تغییر displayUpdatedDate: true dateFormat: "January 2, 2006" + # نمایش نویسنده آخرین تغییر + displayUpdatedAuthor: true ``` ### برچسب‌ها diff --git a/docs/content/docs/guide/configuration.ja.md b/docs/content/docs/guide/configuration.ja.md index 0cb59b5..be6e9f5 100644 --- a/docs/content/docs/guide/configuration.ja.md +++ b/docs/content/docs/guide/configuration.ja.md @@ -285,6 +285,8 @@ params: 日付形式をカスタマイズするには、`params.dateFormat` パラメータを設定します。そのレイアウトは Hugo の [`time.Format`](https://gohugo.io/functions/time/format/) に準拠します。 +さらに、`params.displayUpdatedAuthor` フラグを有効にすると、最終更新の作者を表示できます。これには `enableGitInfo: true` の設定が必要です。 + ```yaml {filename="hugo.yaml"} # Git コミットを解析 enableGitInfo: true @@ -293,6 +295,8 @@ params: # 最終更新日を表示 displayUpdatedDate: true dateFormat: "2006年1月2日" + # 最終更新の作者を表示 + displayUpdatedAuthor: true ``` ### タグ diff --git a/docs/content/docs/guide/configuration.md b/docs/content/docs/guide/configuration.md index 2565faf..da12905 100644 --- a/docs/content/docs/guide/configuration.md +++ b/docs/content/docs/guide/configuration.md @@ -307,6 +307,8 @@ The date of the page's last modification can be displayed by enabling the `param To customize the date format, set the `params.dateFormat` parameter. Its layout matches Hugo's [`time.Format`](https://gohugo.io/functions/time/format/). +Additionally, the author of the last modification can be displayed by enabling the `params.displayUpdatedAuthor` flag. This requires `enableGitInfo: true` to be set. + ```yaml {filename="hugo.yaml"} # Parse Git commit enableGitInfo: true @@ -315,6 +317,8 @@ params: # Display the last modification date displayUpdatedDate: true dateFormat: "January 2, 2006" + # Display the author of the last modification + displayUpdatedAuthor: true ``` ### Tags diff --git a/docs/content/docs/guide/configuration.zh-cn.md b/docs/content/docs/guide/configuration.zh-cn.md index 6082839..a02f0ed 100644 --- a/docs/content/docs/guide/configuration.zh-cn.md +++ b/docs/content/docs/guide/configuration.zh-cn.md @@ -285,6 +285,8 @@ params: 要自定义日期格式,设置 `params.dateFormat` 参数。其布局与 Hugo 的 [`time.Format`](https://gohugo.io/functions/time/format/) 匹配。 +此外,可以通过启用 `params.displayUpdatedAuthor` 标志来显示最后修改的作者。这需要设置 `enableGitInfo: true`。 + ```yaml {filename="hugo.yaml"} # 解析 Git 提交 enableGitInfo: true @@ -293,6 +295,8 @@ params: # 显示最后修改日期 displayUpdatedDate: true dateFormat: "2006年1月2日" + # 显示最后修改的作者 + displayUpdatedAuthor: true ``` ### 标签 diff --git a/docs/hugo.yaml b/docs/hugo.yaml index 222f7f4..09ba9c6 100644 --- a/docs/hugo.yaml +++ b/docs/hugo.yaml @@ -194,6 +194,9 @@ params: displayUpdatedDate: true dateFormat: "January 2, 2006" + # Display the author name of the last modified date + displayUpdatedAuthor: false + # Search # flexsearch is enabled by default search: diff --git a/layouts/_partials/components/last-updated.html b/layouts/_partials/components/last-updated.html index b37987e..f900c0b 100644 --- a/layouts/_partials/components/last-updated.html +++ b/layouts/_partials/components/last-updated.html @@ -1,9 +1,17 @@ {{- $lastUpdated := (T "lastUpdated") | default "Last updated on" -}} +{{- $page := . -}} {{- if site.Params.displayUpdatedDate -}} {{- with .Lastmod -}} {{ $datetime := (time.Format "2006-01-02T15:04:05.000Z" .) }} -
{{ $lastUpdated }}
+
+ {{ $lastUpdated }} + {{- if site.Params.displayUpdatedAuthor -}} + {{- with $page.GitInfo -}} + {{ print " • " .AuthorName | safeHTML }} + {{- end -}} + {{- end -}} +
{{- else -}}
{{- end -}}