From 15d3e40cdfc1f3eef2c2a8dfc0268ef0f5441ab6 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 7 Oct 2024 21:14:17 +0200 Subject: [PATCH] feat: add parameter geekdocPageLastmod (#895) --- exampleSite/config/_default/params.yaml | 1 + exampleSite/content/en/usage/configuration.md | 14 ++++++++++++++ layouts/_default/single.html | 1 + layouts/partials/page-metadata.html | 13 +++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 layouts/partials/page-metadata.html diff --git a/exampleSite/config/_default/params.yaml b/exampleSite/config/_default/params.yaml index dcbbdc8..992023f 100644 --- a/exampleSite/config/_default/params.yaml +++ b/exampleSite/config/_default/params.yaml @@ -11,6 +11,7 @@ geekdocTagsToMenu: true geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc geekdocEditPath: edit/main/exampleSite +geekdocPageLastmod: false geekdocSearch: true geekdocSearchShowParent: true diff --git a/exampleSite/content/en/usage/configuration.md b/exampleSite/content/en/usage/configuration.md index ee0235e..588baa0 100644 --- a/exampleSite/content/en/usage/configuration.md +++ b/exampleSite/content/en/usage/configuration.md @@ -70,6 +70,10 @@ enableRobotsTXT = true # You can also specify this parameter per page in front matter. geekdocEditPath = "edit/main/exampleSite" + # (Optional, default false) Show last modification date of the page in the header. + # Keep in mind that last modification date works best if `enableGitInfo` is set to true. + geekdocPageLastmod = true + # (Optional, default true) Enables search function with flexsearch. # Index is built on the fly and might slow down your website. geekdocSearch = false @@ -196,6 +200,10 @@ params: # You can also specify this parameter per page in front matter. geekdocEditPath: edit/main/exampleSite + # (Optional, default false) Show last modification date of the page in the header. + # Keep in mind that last modification date works best if `enableGitInfo` is set to true. + geekdocPageLastmod: true + # (Optional, default true) Enables search function with flexsearch. # Index is built on the fly and might slow down your website. geekdocSearch: false @@ -294,6 +302,9 @@ geekdocRepo = "https://github.com/thegeeklab/hugo-geekdoc" # the parent directory of the 'content' folder. geekdocEditPath = "edit/main/exampleSite" +# Show last modification date of the page in the header. +geekdocPageLastmod = true + # Used for 'Edit page' link, set to '.File.Path' by default. # Can be overwritten by a path relative to 'geekdocEditPath' geekdocFilePath = @@ -354,6 +365,9 @@ geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc" # the parent directory of the 'content' folder. geekdocEditPath: "edit/main/exampleSite" +# Show last modification date of the page in the header. +geekdocPageLastmod: true + # Used for 'Edit page' link, set to '.File.Path' by default. # Can be overwritten by a path relative to 'geekdocEditPath' geekdocFilePath: diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 94172f6..64bc887 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -6,6 +6,7 @@ class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.geekdocAlign | lower) }}" >

{{ partial "utils/title" . }}

+ {{ partial "page-metadata" . }} {{ partial "utils/content" . }} {{ end }} diff --git a/layouts/partials/page-metadata.html b/layouts/partials/page-metadata.html new file mode 100644 index 0000000..3d71bc3 --- /dev/null +++ b/layouts/partials/page-metadata.html @@ -0,0 +1,13 @@ +{{- $showPageLastmod := (or (default false .Page.Params.geekdocPageLastmod) (default false .Site.Params.geekdocPageLastmod)) -}} + +{{- if $showPageLastmod -}} + + + + +{{- end -}}