:lock: Secure and accessible dark theme static website generator for Hugo https://after-dark.habd.as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

single.html 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. {{ define "header" }}
  2. {{ partial "menu.html" . }}
  3. {{ end }}
  4. {{ define "main" }}
  5. <article itemscope itemtype="http://schema.org/BlogPosting">
  6. {{ template "_internal/schema.html" . }}
  7. <header>
  8. <h1 itemprop="headline">{{ .Title }}</h1>
  9. <p class="muted">
  10. {{ partial "post/meta.html" . }}
  11. </p>
  12. {{ if .Description }}
  13. <blockquote itemprop="description">{{ .Description }}</blockquote>
  14. {{ end }}
  15. {{ with $.Resources.GetMatch "header" }}
  16. {{ $meta_caption := .Params.meta.caption }}
  17. {{ $meta_sameas := .Params.meta.sameas }}
  18. {{ $meta_license := .Params.meta.license }}
  19. {{ $meta_creator := .Params.meta.creator }}
  20. {{ $meta_description := .Params.meta.description }}
  21. {{ $meta_keywords := .Params.meta.keywords }}
  22. {{ $meta_contentlocation := .Params.meta.contentlocation }}
  23. {{ $image600 := .Fill "600x338 q60 Center" }}
  24. {{ $image900 := .Fill "900x506 q70 Center" }}
  25. {{ $image1200 := .Fill "1200x675 q80 Center" }}
  26. {{ $image1600 := .Fill "1600x900 q90 Center" }}
  27. <figure itemscope itemtype="http://schema.org/ImageObject">
  28. <meta itemprop="contentUrl" content="{{ .RelPermalink }}">
  29. <meta itemprop="encodingFormat" content="{{ .MediaType }}">
  30. <meta itemprop="name" content="{{ .Title | plainify }}">
  31. {{ if (urls.Parse $meta_sameas).Host }}
  32. <meta itemprop="sameAs" content="{{ $meta_sameas }}">
  33. {{ end }}
  34. {{ if (urls.Parse $meta_license).Host }}
  35. <meta itemprop="license" content="{{ $meta_license }}">
  36. {{ end }}
  37. {{ with $meta_creator }}
  38. <meta itemprop="creator" content="{{ $meta_creator | plainify }}">
  39. {{ end }}
  40. {{ with $meta_keywords }}
  41. <meta itemprop="keywords" content="{{ delimit . ", " }}">
  42. {{ end }}
  43. {{ with $meta_contentlocation }}
  44. <meta itemprop="contentLocation" content="{{ . | plainify }}">
  45. {{ end }}
  46. <img
  47. itemprop="thumbnail"
  48. alt=""
  49. class="lazyload blur-up"
  50. src="{{ $image600.RelPermalink }}"
  51. data-sizes="auto"
  52. data-src="{{ $image1200.RelPermalink }}"
  53. data-srcset="{{ $image600.RelPermalink }} 600w, {{ $image900.RelPermalink }} 900w, {{ $image1200.RelPermalink }} 1200w, {{ $image1600.RelPermalink }} 1600w"
  54. >
  55. {{ if not .Params.hide_caption }}
  56. {{ if or .Title (or $meta_caption $meta_creator) }}
  57. <style>
  58. .hack header figure[itemtype*="ImageObject"] {
  59. position: relative;
  60. }
  61. .hack header figure[itemtype*="ImageObject"] figcaption {
  62. position: absolute;
  63. bottom: 0;
  64. right: 0;
  65. text-align: right;
  66. padding: 15px;
  67. font-style: oblique;
  68. font-size: smaller;
  69. mix-blend-mode: soft-light;
  70. }
  71. .hack header figure[itemtype*="ImageObject"] [itemprop="description"] {
  72. font-weight: bold;
  73. }
  74. </style>
  75. <figcaption>
  76. {{ with $meta_description }}
  77. <span itemprop="description">{{ . | plainify }}</span>.
  78. {{ end }}
  79. {{ if $meta_caption }}
  80. <span itemprop="caption">{{ $meta_caption | plainify }}</span>
  81. {{ else if $meta_creator }}
  82. <span itemprop="caption">
  83. Photo by {{ $meta_creator | plainify }}
  84. {{- with (urls.Parse $meta_sameas).Host }}
  85. on {{ (strings.TrimSuffix (path.Ext .) .) | title }}
  86. {{- end }}.
  87. </span>
  88. {{ end }}
  89. </figcaption>
  90. {{ end }}
  91. {{ end }}
  92. </figure>
  93. {{ end }}
  94. </header>
  95. {{ partial "toc-maybe.html" . }}
  96. <div itemprop="articleBody">
  97. {{ .Content }}
  98. </div>
  99. {{ if .Site.DisqusShortname }}
  100. <article>
  101. {{ template "_internal/disqus.html" . }}
  102. </article>
  103. {{ end }}
  104. <footer>
  105. <hr>
  106. {{ partial "post/byline.html" . }}
  107. {{ partial "post/related-content.html" . }}
  108. </footer>
  109. </article>
  110. {{ end }}
  111. {{ define "footer" }}
  112. {{ partial "powered-by.html" . }}
  113. {{ partial "cookie-disclaimer.html" . }}
  114. {{ end }}