I currently use the following code to generate the date included in the boilerplate copyright text in the footer of my site:
{{- if .IsHome -}}
2005-{{ .Site.LastChange.Format "2006" }}
{{- else -}}
{{ .Date.Format "2006" }}
{{- end -}}
This covers the case of the home page (where the range of dates goes from the date of the oldest content, which can be hardcoded, to the most recent, which {{ .Site.LastChange.Format "2006" }}
has covered.
It also does what I want for individual pages (articles, in my case), where the date displayed will be the date on which the article was initially written (rather than the date when it was last modified, which some users might prefer).
This leaves, however, the issue of non-homepage indexes, such as /blog/
or, in my case, the articles and photos pages, where the corresponding results ( Copyright Β© Donald Jenkins 2018 and Copyright Β© Donald Jenkins 2019, respectively) merely display the date-parameter included in the front matter of the corresponding index pages in the /layout
section, when, in fact, what one would want to display is a range of dates β like on the front page β but this time stretching from the date recorded in the front matter of the oldest page in the /articles and /photos sections respectively, and the most recent one.
Unfortunately, I havenβt been able to find a way of doing this, but suspect itβs possible. Any suggestions as to how would be very gratefully received.