tile.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink .Type }}
  2. <article class="{{ if $image.exists }}has-image{{ end }}">
  3. <a href="{{ .context.RelPermalink }}">
  4. {{ if $image.exists }}
  5. <div class="article-image">
  6. {{ if $image.resource }}
  7. {{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
  8. {{- $Permalink := $imageRaw.RelPermalink -}}
  9. {{- $Width := $imageRaw.Width -}}
  10. {{- $Height := $imageRaw.Height -}}
  11. {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
  12. {{- $thumbnail := $imageRaw.Fill .size -}}
  13. {{- $Permalink = $thumbnail.RelPermalink -}}
  14. {{- $Width = $thumbnail.Width -}}
  15. {{- $Height = $thumbnail.Height -}}
  16. {{- end -}}
  17. <img src="{{ $Permalink }}"
  18. width="{{ $Width }}"
  19. height="{{ $Height }}"
  20. loading="lazy"
  21. alt="Featured image of post {{ .context.Title }}"
  22. {{ with .context.Slug }}data-key="{{ . }}" {{ end }}
  23. data-hash="{{ $imageRaw.Data.Integrity }}">
  24. {{ else }}
  25. <img src="{{ $image.permalink }}" loading="lazy" data-key="{{ .context.Slug }}" data-hash="{{ $image.permalink }}"/>
  26. {{ end }}
  27. </div>
  28. {{ end }}
  29. <div class="article-details">
  30. <h2 class="article-title">
  31. {{- .context.Title -}}
  32. </h2>
  33. </div>
  34. </a>
  35. </article>