page_metadata.html 2.4 KB

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