diff --git a/layouts/_partials/footer/copyright.html b/layouts/_partials/footer/copyright.html index 1370c5e1f4..ed1823177d 100644 --- a/layouts/_partials/footer/copyright.html +++ b/layouts/_partials/footer/copyright.html @@ -1,21 +1,22 @@ {{ $page := .Page -}} {{ with .Site.Params.copyright -}} - {{ $fromYear := "" -}} - {{ $toYear := "" -}} + {{ $yearDisplay := "" -}} {{ $authors := "" -}} {{ if reflect.IsMap . -}} - {{ $fromYear = .from_year -}} - {{ $toYear = .to_year -}} + {{ $to := .to_year | default now.Year -}} + {{ $yearDisplay = $to -}} + {{ with .from_year -}} + {{ if ne (string .) (string $to) -}} + {{ $yearDisplay = printf "%v–%v" . $to -}} + {{ end -}} + {{ end -}} {{ $authors = .authors -}} {{ else -}} {{ $authors = . -}} {{ end -}} © - {{ with $fromYear -}} - {{ . }}– - {{- end -}} - {{ $toYear | default now.Year }} + {{ $yearDisplay }} {{- $authors | default (printf "%s Authors" ($.Site.Title | default "Site"))