diff --git a/assets/scss/academic/_footer b/assets/scss/academic/_footer new file mode 100644 index 00000000..1becdfd4 --- /dev/null +++ b/assets/scss/academic/_footer @@ -0,0 +1,18 @@ +.footer-license-icons { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + list-style: none; + height: auto; + width: auto; + font-size: 0; // Hack to remove space characters between icons without using UL. + text-decoration: none; +} + +.footer-license-icons img { + display: inline-flex; + margin-right: 8px; + height: 22px; + vertical-align: text-bottom; +} diff --git a/assets/scss/academic/academic.scss b/assets/scss/academic/academic.scss index 1ea38ebc..1c9cf5fc 100644 --- a/assets/scss/academic/academic.scss +++ b/assets/scss/academic/academic.scss @@ -6,6 +6,7 @@ **************************************************/ @import "root"; +@import "footer"; @import "nav"; @import "card"; @import "search"; diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index aed7ab5a..1dae6cbf 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -152,6 +152,10 @@ docs_section_pager = true # Display pager in Docs layout (e.g. tutorials)? # Enable in-built social sharing buttons? (true/false) sharing = true +# Show a copyright license from creativecommons.org in the site footer? +# Page specific copyright licenses are also possible by adding this option to a page's front matter. +copyright_license = {enable = false, allow_derivatives = false, share_alike = true, allow_commercial = false, notice = "This work is licensed under {license}"} + # Link authors to their profile page? (true/false) link_authors = true diff --git a/layouts/partials/site_footer.html b/layouts/partials/site_footer.html index 7a8c2b73..25875bf3 100644 --- a/layouts/partials/site_footer.html +++ b/layouts/partials/site_footer.html @@ -12,8 +12,13 @@ {{ end }}

- {{ with site.Copyright }}{{ replace . "{year}" now.Year | markdownify}} · {{ end }} + {{ with site.Copyright }}{{ replace . "{year}" now.Year | markdownify}}{{ end }} +

+ {{/* Display copyright license. */}} + {{ partial "site_footer_license" . }} + +

Powered by the Academic theme for Hugo. diff --git a/layouts/partials/site_footer_license.html b/layouts/partials/site_footer_license.html new file mode 100644 index 00000000..01ea3a45 --- /dev/null +++ b/layouts/partials/site_footer_license.html @@ -0,0 +1,43 @@ +{{/* Display copyright license. */}} + +{{ $copyright_license := .Params.copyright_license | default site.Params.copyright_license }} + +{{ if and $copyright_license $copyright_license.enable }} + + {{ $notice := .Params.copyright_license.notice | default site.Params.copyright_license.notice }} + {{ $allow_commercial := .Params.allow_commercial | default site.Params.allow_commercial }} + {{ $allow_derivatives := .Params.allow_derivatives | default site.Params.allow_derivatives }} + {{ $share_alike := .Params.share_alike | default site.Params.share_alike }} + + {{$cc_code := "by"}} + {{ if not $allow_commercial }}{{ $cc_code = printf "%s-nc" $cc_code}}{{end}} + {{ if not $allow_derivatives }} + {{ if $share_alike }} + {{ $cc_code = printf "%s-sa" $cc_code}} + {{else}} + {{ $cc_code = printf "%s-nd" $cc_code}} + {{end}} + {{end}} + + {{ $license_url := printf "https://creativecommons.org/licenses/%s/4.0" ($cc_code | urlize) }} + + {{ with $notice }} +

+ {{ end }} + + +{{ end }}