page_metadata.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {{ $is_list := .is_list }}
  2. {{ $page := .page }}
  3. <div class="article-metadata">
  4. {{/* If `authors` is set and is not empty. */}}
  5. {{ if $page.Params.authors }}
  6. {{ $authorLen := len $page.Params.authors }}
  7. {{ if gt $authorLen 0 }}
  8. <div>
  9. {{ partial "page_metadata_authors" $page }}
  10. </div>
  11. {{ end }}
  12. {{ end }}
  13. {{ if not (in (slice "talk" "page") $page.Type) }}
  14. <span class="article-date">
  15. {{ $date := $page.Lastmod.Format site.Params.date_format }}
  16. {{ if eq $page.Type "publication" }}
  17. {{ $date = $page.Date.Format (site.Params.publications.date_format | default "January, 2006") }}
  18. {{ else }}
  19. {{ if ne $page.Params.Lastmod $page.Params.Date }}
  20. {{ i18n "last_updated" }}
  21. {{ end }}
  22. {{ end }}
  23. {{ $date }}
  24. </span>
  25. {{ end }}
  26. {{ if and (eq $is_list 1) (eq $page.Type "publication") }}
  27. <span class="middot-divider"></span>
  28. <span class="pub-publication">
  29. {{ if $page.Params.publication_short }}
  30. {{ $page.Params.publication_short | markdownify }}
  31. {{ else if $page.Params.publication }}
  32. {{ $page.Params.publication | markdownify }}
  33. {{ end }}
  34. </span>
  35. {{ end }}
  36. {{ if and (eq $page.Type "post") (not (or (eq site.Params.reading_time false) (eq $page.Params.reading_time false))) }}
  37. <span class="middot-divider"></span>
  38. <span class="article-reading-time">
  39. {{ $page.ReadingTime }} {{ i18n "minute_read" }}
  40. </span>
  41. {{ end }}
  42. {{/* Show Disqus comment count if enabled. */}}
  43. {{ $commentable_map := site.Params.comments.commentable | default dict }}
  44. {{ $commentable_bool := index $commentable_map $page.Type | default false }}
  45. {{ $disqus_enabled := eq site.Params.comments.engine 1 | and $commentable_bool | and (ne $page.Params.commentable false) | or $page.Params.commentable }}
  46. {{ if and $disqus_enabled (site.Params.comments.disqus.show_count | default true) }}
  47. <span class="middot-divider"></span>
  48. <a href="{{ $page.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>
  49. {{ end}}
  50. {{ $taxonomy := "categories" }}
  51. {{ if $page.Param $taxonomy }}
  52. <span class="middot-divider"></span>
  53. <span class="article-categories">
  54. <i class="fas fa-folder mr-1"></i>
  55. {{- range $index, $value := ($page.GetTerms $taxonomy) -}}
  56. {{- if gt $index 0 }}, {{ end -}}
  57. <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
  58. {{- end -}}
  59. </span>
  60. {{ end }}
  61. </div>