commit e164d140d201676387ed7a5ed56002aff34f4a28 parent d48c45296d2bc62d7ba8680c86d74484492ff7d1 Author: Chris Bracken <chris@bracken.jp> Date: Thu, 7 May 2020 11:48:11 -0700 Add support for Creative Commons licensing When .Site.Params.ccLicenseName is defined, output a Creative Commons license string after the copyright string. Full parameters list: * .Site.Params.ccLicenseName: the name of the Creative Commons license under which the site content is licensed. e.g., "CC BY-SA 4.0" * .Site.Params.ccLicenseUrl: the URL of the license. e.g. "https://creativecommons.org/licenses/by-sa/4.0" * .Site.Params.ccAttributionName: the name of the author. * .Site.Params.ccAttributionUrl: the author URL. Diffstat:
M | layouts/partials/footer.html | | | 29 | +++++++++++++++++++++++------ |
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html @@ -1,13 +1,30 @@ <footer id="footer"> <div class="copyright"> -<p>© -{{- $current := now.Format "2006" }} -{{- if ne .Site.Params.since $current }}{{ .Site.Params.since }}–{{ end }} -{{- $current }} {{- if .Site.Copyright }} {{- .Site.Copyright | safeHTML }} -{{- else }} - {{- .Site.Author.name | safeHTML }} +{{- else if .Site.Params.ccLicenseName }} +<span xmlns:dct="http://purl.org/dc/terms/" xmlns:cc="http://creativecommons.org/ns#"> +The content of this site +{{- if .Site.Params.ccAttributionName }} by +{{- if .Site.Params.ccAttributionUrl }} +<a rel="cc:attributionURL" href="{{ .Site.Params.ccAttributionUrl }}"> +{{- end -}} +<span rel="cc:attributionName">{{ .Site.Params.ccAttributionName }}</span> +{{- if .Site.Params.ccAttributionUrl }}</a>{{ end }} +{{- end }} +is +{{ if .Site.Params.ccLicenseUrl -}} +<a href="{{ .Site.Params.ccLicenseUrl }}"> +{{- end -}} +{{ .Site.Params.ccLicenseName }} +{{- if .Site.Params.ccLicenseUrl }}</a>{{ end }}. +</span> +{{- else -}} +<p>© + {{- $current := now.Format "2006" }} + {{- if ne .Site.Params.since $current }}{{ .Site.Params.since }}–{{ end }} + {{- $current }} + {{- .Site.Author.name | safeHTML }}. {{- end }} </div> </footer>