7
1
mirror of https://gitlab.com/ansol/web-ansol.org.git synced 2024-11-27 00:07:43 +00:00
web-ansol.org/themes/academic/layouts/partials/site_footer_license.html
2020-06-11 12:46:16 +01:00

46 lines
2.1 KiB
HTML

{{/* 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.copyright_license.allow_commercial | default site.Params.copyright_license.allow_commercial }}
{{ $allow_derivatives := .Params.copyright_license.allow_derivatives | default site.Params.copyright_license.allow_derivatives }}
{{ $share_alike := .Params.copyright_license.share_alike | default site.Params.copyright_license.share_alike }}
{{ $cc_code := "by" }}
{{ if not $allow_commercial }}
{{ $cc_code = printf "%s-nc" $cc_code }}
{{end}}
{{ if and $allow_derivatives $share_alike }}
{{ $cc_code = printf "%s-sa" $cc_code }}
{{ else if not $allow_derivatives }}
{{ $cc_code = printf "%s-nd" $cc_code }}
{{end}}
{{ $license_url := printf "https://creativecommons.org/licenses/%s/4.0" ($cc_code | urlize) }}
{{ with $notice }}
<p class="powered-by copyright-license-text">
{{ replace . "{license}" (printf "<a href=\"%s\" rel=\"noopener noreferrer\" target=\"_blank\">CC %s 4.0</a>" $license_url (replace $cc_code "-" " " | upper)) | markdownify }}
</p>
{{ end }}
<p class="powered-by footer-license-icons">
<a href="{{$license_url}}" rel="noopener noreferrer" target="_blank">
<img src="https://search.creativecommons.org/static/img/cc_icon.svg" alt="CC icon">
<img src="https://search.creativecommons.org/static/img/cc-by_icon.svg" alt="CC by icon">
{{ if not $allow_commercial }}
<img src="https://search.creativecommons.org/static/img/cc-nc_icon.svg" alt="CC NC icon">
{{end}}
{{ if and $allow_derivatives $share_alike }}
<img src="https://search.creativecommons.org/static/img/cc-sa_icon.svg" alt="CC SA icon">
{{ else if not $allow_derivatives }}
<img src="https://search.creativecommons.org/static/img/cc-nd_icon.svg" alt="CC ND icon">
{{end}}
</a>
</p>
{{ end }}