page_metadata.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. <script id="dsq-count-scr" src="https://{{site.Params.comments.disqus.shortname}}.disqus.com/count.js" async></script>
  51. {{ end}}
  52. {{ $taxonomy := "categories" }}
  53. {{ with $page.Param $taxonomy }}
  54. <span class="middot-divider"></span>
  55. <span class="article-categories">
  56. <i class="fas fa-folder"></i>
  57. {{ range $index, $value := . -}}
  58. {{- if gt $index 0 }}, {{ end -}}
  59. <a href="{{ (site.GetPage (printf "/%s/%s" $taxonomy (. | urlize))).RelPermalink }}">{{ . }}</a>
  60. {{- end -}}
  61. </span>
  62. {{ end }}
  63. {{ if $share }}
  64. {{ partial "share.html" $page }}
  65. {{ end }}
  66. </div>