page_metadata.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. {{ $is_list := .is_list }}
  2. {{ $ := .content }}
  3. <div class="article-metadata">
  4. {{/* If `authors` is set and is not empty. */}}
  5. {{ if $.Params.authors }}
  6. {{ $authorLen := len $.Params.authors }}
  7. <div>
  8. {{ range $k, $v := $.Params.authors -}}
  9. <span itemscope itemprop="author" itemtype="http://schema.org/Person">
  10. <span itemprop="name">
  11. {{with $.Site.GetPage (printf "/authors/%s" $v) }}{{ printf "<a href=\"%s\">" .RelPermalink | safeHTML }}{{end}}
  12. {{- $v | markdownify -}}
  13. {{with $.Site.GetPage (printf "/authors/%s" $v) }}{{ printf "</a>" | safeHTML }}{{end}}
  14. </span>
  15. </span>
  16. {{- if lt $k (sub $authorLen 1) -}}, {{ end }}
  17. {{ end }}
  18. </div>
  19. {{ else }}
  20. <span itemscope itemprop="author" itemtype="http://schema.org/Person">
  21. <meta itemprop="name" content="{{ $.Site.Params.name }}">
  22. </span>
  23. {{ end }}
  24. <span class="article-date">
  25. {{ if ne $.Params.Lastmod $.Params.Date }}
  26. {{ i18n "last_updated" }}
  27. {{ end }}
  28. <meta content="{{ $.Params.Date }}" itemprop="datePublished">
  29. <time datetime="{{ $.Params.LastMod }}" itemprop="dateModified">
  30. {{ $.Lastmod.Format $.Site.Params.date_format }}
  31. </time>
  32. </span>
  33. <span itemscope itemprop="publisher" itemtype="http://schema.org/Person">
  34. <meta itemprop="name" content="{{ $.Site.Params.name }}">
  35. </span>
  36. {{ if and (eq $.Type "post") (not (or (eq $.Site.Params.reading_time false) (eq $.Params.reading_time false))) }}
  37. <span class="middot-divider"></span>
  38. <span class="article-reading-time">
  39. {{ $.ReadingTime }} {{ i18n "minute_read" }}
  40. </span>
  41. {{ end }}
  42. {{ $comments_enabled := and $.Site.DisqusShortname (not (or $.Site.Params.disable_comments (eq $.Params.comments false))) }}
  43. {{ if and $comments_enabled ($.Site.Params.comment_count | default true) }}
  44. <span class="middot-divider"></span>
  45. <a href="{{ $.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>
  46. {{ end}}
  47. {{ if $.Params.categories }}
  48. {{ $categoriesLen := len $.Params.categories }}
  49. {{ if gt $categoriesLen 0 }}
  50. <span class="middot-divider"></span>
  51. <span class="article-categories">
  52. <i class="fas fa-folder"></i>
  53. {{ range $k, $v := $.Params.categories }}
  54. <a href="{{ ($.Site.GetPage (printf "categories/%s" .)).RelPermalink }}">{{ . }}</a>
  55. {{- if lt $k (sub $categoriesLen 1) -}}, {{ end }}
  56. {{ end }}
  57. </span>
  58. {{ end }}
  59. {{ end }}
  60. {{ if ne $is_list 1 }}
  61. {{ partial "share.html" $ }}
  62. {{ end }}
  63. </div>