<footer class="footer" style="margin-top: 20px;">
  <!-- Option for user to inject custom html -->
  {{ if .Site.Params.CustomFooterHTML }}
  {{ .Site.Params.CustomFooterHTML | safeHTML }}
  {{ end }}

  {{ .Scratch.Set "footerText" "" }}

  {{ if (.Site.Params.Footer) }}

  {{ if and (eq .Kind "page") (.Date) }}
  {{ .Scratch.Add "footerText" (.Date | time.Format "2006") }}
  {{ else }}
  {{ .Scratch.Add "footerText" (time.Now | time.Format "2006") }}
  {{ end }}

  {{ if and (eq .Kind "page") (.Lastmod) (gt (time.Format "2006" .Lastmod) (time.Format "2006" .Date)) }}
  {{ .Scratch.Add "footerText" "-" }}
  {{ .Scratch.Add "footerText" (.Lastmod | time.Format "2006") }}
  {{ end }}

  {{ .Scratch.Add "footerText" " " }}
  {{ .Scratch.Add "footerText" .Site.Params.Footer }}

  {{ if and (eq .Kind "page") (.Site.Copyright) }}
  {{ .Scratch.Add "footerText" " " }}
  {{ .Scratch.Add "footerText" .Site.Copyright }}
  {{ end }}

  {{ end }}

  {{ if (gt (.Scratch.Get "footerText" | len) 0) }}
  <span>&copy; {{ .Scratch.Get "footerText" | markdownify }}</span>
  {{ end }}

  <span style="font-size: 0.85em; max-width: 600px; display: inline-block; line-height: 1.4; margin-top: 20px;">
    &copy; Nate Anderson {{ now.Format "2006" }}. Content may be read and shared freely for personal use.
    Commercial data collection is prohibited without written consent.
    <a href="/terms/">Terms of Use</a>.
  </span>
</footer>