From c60d1f5de760ed6ae2ee49a7b5fbee0fac25da7d Mon Sep 17 00:00:00 2001 From: yuri <1969yuri1969@gmail.com> Date: Thu, 23 Jan 2025 21:58:03 +0100 Subject: [PATCH] docs: describe page last modification date (#562) --- exampleSite/content/docs/guide/configuration.md | 16 ++++++++++++++++ exampleSite/hugo.yaml | 2 ++ 2 files changed, 18 insertions(+) diff --git a/exampleSite/content/docs/guide/configuration.md b/exampleSite/content/docs/guide/configuration.md index 9c7a8f64..7b41273b 100644 --- a/exampleSite/content/docs/guide/configuration.md +++ b/exampleSite/content/docs/guide/configuration.md @@ -212,6 +212,22 @@ Options for `theme.default`: The `theme.displayToggle` parameter allows you to display a toggle button for changing themes. When set to `true`, visitors can switch between light or dark mode, overriding the default setting. +### Page Last Modification + +The date of the page's last modification can be displayed by enabling the `params.displayUpdatedDate` flag. To use Git commit date as the source, enable also the `enableGitInfo` flag. + +To customize the date format, set the `params.dateFormat` parameter. Its layout matches Hugo's [`time.Format`](https://gohugo.io/functions/time/format/). + +```yaml {filename="hugo.yaml"} +# Parse Git commit +enableGitInfo: true + +params: + # Display the last modification date + displayUpdatedDate: true + dateFormat: "January 2, 2006" +``` + ### Page Width The width of the page can be customized by the `params.page.width` parameter in the config file: diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index d49b3179..4acc4033 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -3,6 +3,7 @@ baseURL: "https://example.com/" title: "Hextra" enableRobotsTXT: true +# Parse Git commit enableGitInfo: true # enableEmoji: false hasCJKLanguage: true @@ -135,6 +136,7 @@ params: displayPoweredBy: true width: normal + # Display the last modification date displayUpdatedDate: true dateFormat: "January 2, 2006"