title.html 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {{- $title := .Title -}}
  2. {{- $siteTitle := .Site.Title -}}
  3. {{- if .IsHome -}}
  4. <!-- Homepage, and it's pagination -->
  5. <!-- Build paginator -->
  6. {{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
  7. {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
  8. {{ $filtered := ($pages | intersect $notHidden) }}
  9. {{ $pag := .Paginate ($filtered) }}
  10. {{ if .Paginator.HasPrev }}
  11. <!-- Paginated. Append page number to title -->
  12. {{ $title = printf "%s - %s" .Paginator $siteTitle }}
  13. {{ else }}
  14. {{ $title = $siteTitle}}
  15. {{ end }}
  16. {{- else if eq .Kind "term" -}}
  17. <!-- Taxonomy page -->
  18. <!-- Build paginator -->
  19. {{ $notHidden := where .Pages "Params.hidden" "!=" true }}
  20. {{ $pag := .Paginate ($notHidden) }}
  21. <!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
  22. {{ $title = slice (title .Data.Singular) ": " $title }}
  23. {{ if .Paginator.HasPrev }}
  24. <!-- Add page number-->
  25. {{ $title = $title | append " - " .Paginator }}
  26. {{ end }}
  27. {{ $title = $title | append " - " $siteTitle }}
  28. {{ $title = delimit $title "" }}
  29. {{- end -}}
  30. {{ return $title }}