page_metadata.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 "event" "page") $page.Type) | and (ne $page.Params.show_date false) }}
  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. {{ $comments_provider := trim (site.Params.comments.provider | lower) " " }}
  44. {{ $commentable_page_types := site.Params.comments.commentable | default dict }}
  45. {{ $commentable_page_type := index $commentable_page_types $page.Type | default false }}
  46. {{ $commentable_page := (ne $page.Params.commentable false) | and $commentable_page_type }}
  47. {{ if (eq $comments_provider "disqus") | and (site.Params.comments.disqus.show_count | default true) | and $commentable_page }}
  48. <span class="middot-divider"></span>
  49. <a href="{{ $page.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>
  50. {{ end}}
  51. {{ $taxonomy := "categories" }}
  52. {{ if $page.Param $taxonomy }}
  53. <span class="middot-divider"></span>
  54. <span class="article-categories">
  55. <i class="fas fa-folder mr-1"></i>
  56. {{- range $index, $value := ($page.GetTerms $taxonomy) -}}
  57. {{- if gt $index 0 }}, {{ end -}}
  58. <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
  59. {{- end -}}
  60. </span>
  61. {{ end }}
  62. </div>