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.

111 satır
4.3KB

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