theme: make content footer configurable #1025

This commit is contained in:
Sören Weber 2025-02-17 20:51:20 +01:00
parent 00590db6bb
commit 1ebb5451c3
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
13 changed files with 103 additions and 15 deletions

View file

@ -401,6 +401,32 @@ boxStyle = [
{ identifier = 'magic', i18n = '', title = 'Magic', icon = 'rainbow', color = 'gold' } { identifier = 'magic', i18n = '', title = 'Magic', icon = 'rainbow', color = 'gold' }
] ]
# Hide the authors name and email addresses
# Default: false
# If the standard content-footer finds author name information, you can
# disable the output of this and the according email address by setting this
# parameter to `true`.
hideAuthorName = false
# Hide the authors email addresses
# Default: false
# If the standard content-footer finds an authors email address, you can
# disable the output by setting this parameter to `true`.
hideAuthorEmail = false
# Hide the authoring date
# Default: false
# If the standard content-footer finds an authoring date, you can
# disable the output by setting this parameter to `true`.
hideAuthorDate = false
# Date format
# Default: ':date_medium'
# The date format used for the date in the standard content-footer, when
# displaying a pages meta information. See https://gohugo.io/functions/time/format/#localization
# for possible values.
dateFormat = ':date_medium'
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Highlight # Highlight
# These options configure how code is displayed. # These options configure how code is displayed.

View file

@ -64,6 +64,8 @@ headingPre = '<i class="fab fa-github"></i> '
- `AuthorEmail` if [GitInfo](https://gohugo.io/methods/page/gitinfo/) is active, otherwise `LastModifierEmail` front matter - `AuthorEmail` if [GitInfo](https://gohugo.io/methods/page/gitinfo/) is active, otherwise `LastModifierEmail` front matter
- `AuthorDate` if [GitInfo](https://gohugo.io/methods/page/gitinfo/) is active, otherwise [Hugo's `date` front matter](https://gohugo.io/methods/page/date/) - `AuthorDate` if [GitInfo](https://gohugo.io/methods/page/gitinfo/) is active, otherwise [Hugo's `date` front matter](https://gohugo.io/methods/page/date/)
See how to further [configure this information](configuration/content/meta) on a site-wide basis.
{{< multiconfig fm=true >}} {{< multiconfig fm=true >}}
LastModifierDisplayName = 'Santa Claus' LastModifierDisplayName = 'Santa Claus'
LastModifierEmail = 'santa@example.com' LastModifierEmail = 'santa@example.com'

View file

@ -3,7 +3,7 @@ categories = ["howto"]
description = "Configuring heading anchors" description = "Configuring heading anchors"
options = ["disableAnchorCopy", "disableAnchorScrolling"] options = ["disableAnchorCopy", "disableAnchorScrolling"]
title = "Headings" title = "Headings"
weight = 3 weight = 4
+++ +++
Headings can have anchor links that appear when you hover over them. Headings can have anchor links that appear when you hover over them.

View file

@ -3,6 +3,6 @@ categories = ["howto"]
description = "Configuring heading anchors" description = "Configuring heading anchors"
options = ["disableAnchorCopy", "disableAnchorScrolling"] options = ["disableAnchorCopy", "disableAnchorScrolling"]
title = "Headings" title = "Headings"
weight = 3 weight = 4
+++ +++
{{< piratify >}} {{< piratify >}}

View file

@ -3,7 +3,7 @@ categories = ["explanation", "howto"]
description = "Learn about the hidden pages feature" description = "Learn about the hidden pages feature"
options = ["disableSearchHiddenPages", "disableSeoHiddenPages", "disableTagHiddenPages"] options = ["disableSearchHiddenPages", "disableSeoHiddenPages", "disableTagHiddenPages"]
title = "Hidden Pages" title = "Hidden Pages"
weight = 5 weight = 6
+++ +++
This theme allows you to [create hidden pages](authoring/meta#hidden). This theme allows you to [create hidden pages](authoring/meta#hidden).

View file

@ -3,6 +3,6 @@ categories = ["explanation", "howto"]
description = "Learn about the hidden pages feature" description = "Learn about the hidden pages feature"
options = ["disableSearchHiddenPages", "disableSeoHiddenPages", "disableTagHiddenPages"] options = ["disableSearchHiddenPages", "disableSeoHiddenPages", "disableTagHiddenPages"]
title = "Hidden Pages" title = "Hidden Pages"
weight = 5 weight = 6
+++ +++
{{< piratify >}} {{< piratify >}}

View file

@ -3,7 +3,7 @@ categories = ["howto"]
description = "What options are available for links and images" description = "What options are available for links and images"
options = ["disableDefaultRelref", "disableExplicitIndexURLs"] options = ["disableDefaultRelref", "disableExplicitIndexURLs"]
title = "Linking" title = "Linking"
weight = 4 weight = 5
+++ +++
Further [settings are available](authoring/frontmatter/linking) to be used in your configuration or front matter. Further [settings are available](authoring/frontmatter/linking) to be used in your configuration or front matter.

View file

@ -3,6 +3,6 @@ categories = ["howto"]
description = "What options are available for links and images" description = "What options are available for links and images"
options = ["disableDefaultRelref", "disableExplicitIndexURLs"] options = ["disableDefaultRelref", "disableExplicitIndexURLs"]
title = "Linking" title = "Linking"
weight = 4 weight = 5
+++ +++
{{< piratify >}} {{< piratify >}}

View file

@ -0,0 +1,49 @@
+++
categories = ["howto"]
description = "Display page meta information with your content"
options = ["dateFormat", "hideAuthorName", "hideAuthorEmail", "hideAuthorDate"]
title = "Page Meta Information"
weight = 3
+++
The theme supports a default display of page meta information in `layouts/partials/content-footer.html`.
The content footer dynamically pulls information based on the availability of [GitInfo metadata](https://gohugo.io/methods/page/gitinfo/). If Git information is present, it uses the author's name, email, and the date from the Git commit details. This ensures that the displayed information is always up-to-date with the latest modifications.
In cases where Git information is not available, the theme falls back to `LastModifierDisplayName`, `LastModifierEmail`, and `Date` [defined in the page's front matter](authoring/meta#footer-information).
## Disable Display of Author's Name
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} You can disable the output of an author's name and its according email address by setting this parameter to `true`.
{{< multiconfig file=hugo >}}
[params]
hideAuthorName = true
{{< /multiconfig >}}
## Disable Display of Author's Email
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} The author's email, when displayed, is presented as a clickable mailto link, providing a convenient way for readers to reach out. You can disable the output of an author's email address by setting this parameter to `true`.
{{< multiconfig file=hugo >}}
[params]
hideAuthorEmail = true
{{< /multiconfig >}}
## Disable Display of Authoring Date
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} # If the standard content-footer finds an authoring date, you can disable its output by setting this parameter to `true`.
{{< multiconfig file=hugo >}}
[params]
hideAuthorEmail = true
{{< /multiconfig >}}
## Adjust the Timestamp Format
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} You can overwrite the default date format used when displaying a pages meta information. See [the Hugo docs](https://gohugo.io/functions/time/format/#localization) for possible values.
{{< multiconfig file=hugo >}}
[params]
dateFormat = ':date_medium'
{{< /multiconfig >}}

View file

@ -0,0 +1,8 @@
+++
categories = ["howto"]
description = "Display page meta information with your content"
options = ["dateFormat", "hideAuthorName", "hideAuthorEmail", "hideAuthorDate"]
title = "Page Meta Information"
weight = 3
+++
{{< piratify >}}

View file

@ -48,6 +48,8 @@ weight = -4
This was done to be compatible with adding custom scripts in an older version of the Hugo documentation. This was done to be compatible with adding custom scripts in an older version of the Hugo documentation.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} If you haven't overridden `layouts/partials/content-footer.html`, you can now [configure which page meta information](configuration/content/meta) - like author's name, email address and authoring date - should be displayed. Also the date format is now configurable.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The logo color is now configurable via the `--MENU-HEADER-color` variable in your variant stylesheets. - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The logo color is now configurable via the `--MENU-HEADER-color` variable in your variant stylesheets.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Now favicons are also searched in the `assets/images` directory. - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Now favicons are also searched in the `assets/images` directory.

View file

@ -1,25 +1,26 @@
{{- $LastModifierDisplayName := "" }} {{- $LastModifierDisplayName := "" }}
{{- $LastModifierEmail := "" }} {{- $LastModifierEmail := "" }}
{{- $Date := "" }} {{- $Date := "" }}
{{- $dateFormat := site.Params.dateFormat | default ":date_medium" }}
{{- with .GitInfo }} {{- with .GitInfo }}
{{- with .AuthorName }} {{- with and (not site.Params.hideAuthorName) .AuthorName }}
{{- $LastModifierDisplayName = . }} {{- $LastModifierDisplayName = . }}
{{- end }} {{- end }}
{{- with .AuthorEmail }} {{- with and (not site.Params.hideAuthorEmail) .AuthorEmail }}
{{- $LastModifierEmail = . }} {{- $LastModifierEmail = . }}
{{- end }} {{- end }}
{{- with .AuthorDate }} {{- with and (not site.Params.hideAuthorDate) .AuthorDate }}
{{- $Date = . | time.Format ":date_medium" }} {{- $Date = . | time.Format $dateFormat }}
{{- end }} {{- end }}
{{- else }} {{- else }}
{{- with .Params.LastModifierDisplayName }} {{- with and (not site.Params.hideAuthorName) .Params.LastModifierDisplayName }}
{{- $LastModifierDisplayName = . }} {{- $LastModifierDisplayName = . }}
{{- end }} {{- end }}
{{- with .Params.LastModifierEmail }} {{- with and (not site.Params.hideAuthorEmail) .Params.LastModifierEmail }}
{{- $LastModifierEmail = . }} {{- $LastModifierEmail = . }}
{{- end }} {{- end }}
{{- with .Date }} {{- with and (not site.Params.hideAuthorDate) .Date }}
{{- $Date = . | time.Format ":date_medium" }} {{- $Date = . | time.Format $dateFormat }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if $LastModifierDisplayName }} {{- if $LastModifierDisplayName }}

View file

@ -1 +1 @@
7.3.2+648b0d249b63bf77788692ad753f8d4a00e14537 7.3.2+00590db6bbc0743775238176a01124a654be9887