page_metadata.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {{ $is_list := .is_list }}
  2. {{ $share := .share | default false }}
  3. {{ $page := .page }}
  4. <meta content="{{ $page.Params.Date }}" itemprop="datePublished">
  5. <meta content="{{ $page.Params.LastMod }}" itemprop="dateModified">
  6. <div class="article-metadata">
  7. {{/* If `authors` is set and is not empty. */}}
  8. {{ if $page.Params.authors }}
  9. {{ $authorLen := len $page.Params.authors }}
  10. {{ if gt $authorLen 0 }}
  11. <div>
  12. {{ partial "page_metadata_authors" $page }}
  13. </div>
  14. {{ end }}
  15. {{ end }}
  16. {{ if not (in (slice "talk" "page") $page.Type) }}
  17. <span class="article-date">
  18. {{ $date := $page.Lastmod.Format site.Params.date_format }}
  19. {{ if eq $page.Type "publication" }}
  20. {{ $date = $page.Date.Format (site.Params.publications.date_format | default "January, 2006") }}
  21. {{ else }}
  22. {{ if ne $page.Params.Lastmod $page.Params.Date }}
  23. {{ i18n "last_updated" }}
  24. {{ end }}
  25. {{ end }}
  26. <time>{{ $date }}</time>
  27. </span>
  28. {{ end }}
  29. {{ if and (eq $is_list 1) (eq $page.Type "publication") }}
  30. <span class="middot-divider"></span>
  31. <span class="pub-publication">
  32. {{ if $page.Params.publication_short }}
  33. {{ $page.Params.publication_short | markdownify }}
  34. {{ else if $page.Params.publication }}
  35. {{ $page.Params.publication | markdownify }}
  36. {{ end }}
  37. </span>
  38. {{ end }}
  39. {{ if and (eq $page.Type "post") (not (or (eq site.Params.reading_time false) (eq $page.Params.reading_time false))) }}
  40. <span class="middot-divider"></span>
  41. <span class="article-reading-time">
  42. {{ $page.ReadingTime }} {{ i18n "minute_read" }}
  43. </span>
  44. {{ end }}
  45. {{/* Show Disqus comment count if enabled. */}}
  46. {{ $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 }}
  47. {{ if and $disqus_enabled (site.Params.comments.disqus.show_count | default true) }}
  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. {{ with $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 := . -}}
  57. {{- if gt $index 0 }}, {{ end -}}
  58. <a href="{{ (site.GetPage (printf "/%s/%s" $taxonomy (. | urlize))).RelPermalink }}">{{ . }}</a>
  59. {{- end -}}
  60. </span>
  61. {{ end }}
  62. {{ if $share }}
  63. {{ partial "share.html" $page }}
  64. {{ end }}
  65. </div>