Allow overriding the site global copyright with page local params (#810)

This is useful when certain sub pages may have a different copyright
than the entire rest of the site.
This commit is contained in:
Levente Polyak
2026-04-08 13:39:43 +02:00
committed by GitHub
parent 4f0e89c4ed
commit 97d7ee40ed
3 changed files with 9 additions and 2 deletions
+7
View File
@@ -127,6 +127,9 @@ enableGitInfo = true
# You can remove related files with config below # You can remove related files with config below
disableKinds = ['taxonomy', 'taxonomyTerm'] disableKinds = ['taxonomy', 'taxonomyTerm']
# (Optional) Copyright information of the hugo book content
copyright = '[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)'
[params] [params]
# (Optional, default light) Sets color theme: light, dark or auto. # (Optional, default light) Sets color theme: light, dark or auto.
# Theme 'auto' switches between dark and light modes based on browser/os preferences. With plugins/themes added there are more themes. # Theme 'auto' switches between dark and light modes based on browser/os preferences. With plugins/themes added there are more themes.
@@ -202,6 +205,10 @@ type = 'docs'
# Set page weight to re-arrange items in file-tree menu. # Set page weight to re-arrange items in file-tree menu.
weight = 10 weight = 10
# (Optional) Copyright information of the hugo page content
# Can be used to override the site-wide copyright notice
copyright = '[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)'
# (Optional) Set to 'true' to mark page as flat section in file-tree menu. # (Optional) Set to 'true' to mark page as flat section in file-tree menu.
bookFlatSection = false bookFlatSection = false
+1 -1
View File
@@ -1 +1 @@
<small>{{ .Site.Title }} - {{ .Site.Copyright | .RenderString }}</small> <small>{{ .Site.Title }} - {{ default .Site.Copyright .Params.Copyright | .RenderString }}</small>
+1 -1
View File
@@ -71,7 +71,7 @@
{{ end }} {{ end }}
{{ define "copyright" }} {{ define "copyright" }}
{{ if .Site.Copyright }} {{ if or .Site.Copyright .Params.Copyright }}
<div class="book-copyright flex justify-center"> <div class="book-copyright flex justify-center">
{{ partial "docs/copyright" . }} {{ partial "docs/copyright" . }}
</div> </div>