From 6158e5eaf9105a87da6393b0fb0179e4f2b59742 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Mon, 15 Dec 2025 19:16:54 +0000 Subject: [PATCH] fix: Creative Commons footer attribution text and icons Also, drops experimental license type 'all_rights' Fixes #3289 --- .../_partials/site_footer_license.html | 76 +++++++++++-------- .../academic-cv/config/_default/params.yaml | 2 +- templates/blog/config/_default/params.yaml | 2 +- .../documentation/config/_default/params.yaml | 2 +- .../landing-page/config/_default/params.yaml | 2 +- .../link-in-bio/config/_default/params.yaml | 2 +- templates/resume/config/_default/params.yaml | 2 +- 7 files changed, 52 insertions(+), 36 deletions(-) diff --git a/modules/blox-tailwind/layouts/_partials/site_footer_license.html b/modules/blox-tailwind/layouts/_partials/site_footer_license.html index bc52bfd3..305cd142 100644 --- a/modules/blox-tailwind/layouts/_partials/site_footer_license.html +++ b/modules/blox-tailwind/layouts/_partials/site_footer_license.html @@ -1,14 +1,23 @@ {{/* Display copyright license. */}} {{ $branding := partialCached "functions/get_branding" . "branding" }} -{{ $copyright_license := .Params.copyright.license | default site.Params.hugoblox.copyright.license }} -{{ $notice := .Params.copyright.notice | default site.Params.hugoblox.copyright.notice }} +{{ $page_copyright := .Params.copyright | default dict }} +{{ $site_copyright := site.Params.hugoblox.copyright | default dict }} -{{ if ($copyright_license.enable | default false) }} +{{ $copyright_license := $page_copyright.license | default $site_copyright.license | default dict }} +{{ $notice := $page_copyright.notice | default $site_copyright.notice }} - {{ $allow_commercial := $copyright_license.allow_commercial | default false }} - {{ $allow_derivatives := $copyright_license.allow_derivatives | default false }} - {{ $share_alike := $copyright_license.share_alike | default true }} +{{ $license_type := $copyright_license.type | default "cc" }} + +{{ $license_label := "" }} +{{ $license_url := "" }} +{{ $show_cc_icons := false }} + +{{ $allow_commercial := $copyright_license.allow_commercial | default false }} +{{ $allow_derivatives := $copyright_license.allow_derivatives | default false }} +{{ $share_alike := $copyright_license.share_alike | default true }} + +{{ if eq $license_type "cc" }} {{ $cc_code := "by" }} {{ if not $allow_commercial }} @@ -20,40 +29,47 @@ {{ $cc_code = printf "%s-nd" $cc_code }} {{end}} - {{ $license_url := printf "https://creativecommons.org/licenses/%s/4.0" ($cc_code | urlize) }} + {{ $license_url = printf "https://creativecommons.org/licenses/%s/4.0" ($cc_code | urlize) }} + {{ $license_label = printf "CC %s 4.0" $license_url (replace $cc_code "-" " " | upper) }} + {{ $show_cc_icons = true }} - {{ with $notice }} -

- {{ $processed := replace . "{year}" now.Year }} - {{ $processed = replace $processed "{name}" $branding.organization }} - {{ $processed = replace $processed "{license}" (printf "CC %s 4.0" $license_url (replace $cc_code "-" " " | upper)) }} - {{ $processed | markdownify }} -

+{{ else if eq $license_type "custom" }} + + {{ $custom_label := $copyright_license.label | default $copyright_license.text | default "" }} + {{ $custom_url := $copyright_license.url | default "" }} + {{ if and $custom_label $custom_url }} + {{ $license_label = printf "%s" $custom_url $custom_label }} + {{ else }} + {{ $license_label = $custom_label }} {{ end }} - -{{ else }} +{{ end }} - {{ with $notice }} -

- {{ $processed := replace . "{year}" now.Year }} - {{ $processed = replace $processed "{name}" $branding.organization }} - {{ $processed | markdownify }} -

- {{ end }} - +{{ with $notice }} +

+ {{ $processed := replace . "{year}" now.Year }} + {{ $processed = replace $processed "{name}" $branding.organization }} + {{ $processed = replace $processed "{license}" $license_label }} + {{ $processed | markdownify }} +

{{ end }} diff --git a/templates/academic-cv/config/_default/params.yaml b/templates/academic-cv/config/_default/params.yaml index 92273145..2f73d5a9 100644 --- a/templates/academic-cv/config/_default/params.yaml +++ b/templates/academic-cv/config/_default/params.yaml @@ -118,7 +118,7 @@ hugoblox: # Copyright notice - supports {year}, {name}, {license} placeholders notice: "© {year} {name}. This work is licensed under {license}" license: - type: cc # cc | all_rights | custom + type: cc # cc | custom allow_derivatives: false share_alike: true allow_commercial: false diff --git a/templates/blog/config/_default/params.yaml b/templates/blog/config/_default/params.yaml index f473ffc0..58edddc0 100644 --- a/templates/blog/config/_default/params.yaml +++ b/templates/blog/config/_default/params.yaml @@ -118,7 +118,7 @@ hugoblox: # Copyright notice - supports {year}, {name}, {license} placeholders notice: "© {year} {name}. This work is licensed under {license}" license: - type: cc # cc | all_rights | custom + type: cc # cc | custom allow_derivatives: false share_alike: true allow_commercial: false diff --git a/templates/documentation/config/_default/params.yaml b/templates/documentation/config/_default/params.yaml index f473ffc0..58edddc0 100644 --- a/templates/documentation/config/_default/params.yaml +++ b/templates/documentation/config/_default/params.yaml @@ -118,7 +118,7 @@ hugoblox: # Copyright notice - supports {year}, {name}, {license} placeholders notice: "© {year} {name}. This work is licensed under {license}" license: - type: cc # cc | all_rights | custom + type: cc # cc | custom allow_derivatives: false share_alike: true allow_commercial: false diff --git a/templates/landing-page/config/_default/params.yaml b/templates/landing-page/config/_default/params.yaml index f473ffc0..58edddc0 100644 --- a/templates/landing-page/config/_default/params.yaml +++ b/templates/landing-page/config/_default/params.yaml @@ -118,7 +118,7 @@ hugoblox: # Copyright notice - supports {year}, {name}, {license} placeholders notice: "© {year} {name}. This work is licensed under {license}" license: - type: cc # cc | all_rights | custom + type: cc # cc | custom allow_derivatives: false share_alike: true allow_commercial: false diff --git a/templates/link-in-bio/config/_default/params.yaml b/templates/link-in-bio/config/_default/params.yaml index f473ffc0..58edddc0 100644 --- a/templates/link-in-bio/config/_default/params.yaml +++ b/templates/link-in-bio/config/_default/params.yaml @@ -118,7 +118,7 @@ hugoblox: # Copyright notice - supports {year}, {name}, {license} placeholders notice: "© {year} {name}. This work is licensed under {license}" license: - type: cc # cc | all_rights | custom + type: cc # cc | custom allow_derivatives: false share_alike: true allow_commercial: false diff --git a/templates/resume/config/_default/params.yaml b/templates/resume/config/_default/params.yaml index f473ffc0..58edddc0 100644 --- a/templates/resume/config/_default/params.yaml +++ b/templates/resume/config/_default/params.yaml @@ -118,7 +118,7 @@ hugoblox: # Copyright notice - supports {year}, {name}, {license} placeholders notice: "© {year} {name}. This work is licensed under {license}" license: - type: cc # cc | all_rights | custom + type: cc # cc | custom allow_derivatives: false share_alike: true allow_commercial: false