compact.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <article>
  2. <a href="{{ .RelPermalink }}">
  3. <div class="article-details">
  4. <h2 class="article-title">
  5. {{- .Title -}}
  6. </h2>
  7. <footer class="article-time">
  8. <time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
  9. {{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
  10. </time>
  11. </footer>
  12. </div>
  13. {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
  14. {{ if $image.exists }}
  15. <div class="article-image">
  16. {{ if $image.resource }}
  17. {{- $Permalink := $image.resource.RelPermalink -}}
  18. {{- $Width := $image.resource.Width -}}
  19. {{- $Height := $image.resource.Height -}}
  20. {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
  21. {{- $thumbnail := $image.resource.Fill "120x120" -}}
  22. {{- $Permalink = $thumbnail.RelPermalink -}}
  23. {{- $Width = $thumbnail.Width -}}
  24. {{- $Height = $thumbnail.Height -}}
  25. {{- end -}}
  26. <img src="{{ $Permalink }}"
  27. width="{{ $Width }}"
  28. height="{{ $Height }}"
  29. alt="{{ .Title }}"
  30. loading="lazy">
  31. {{ else }}
  32. <img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" />
  33. {{ end }}
  34. </div>
  35. {{ end }}
  36. </a>
  37. </article>