Browse Source

use resource based featured image

master
Alexander Avery 9 months ago
parent
commit
229492e397
  1. 2
      layouts/partials/article-card.html
  2. 2
      layouts/partials/article-meta.html
  3. 7
      layouts/partials/image.html

2
layouts/partials/article-card.html

@ -1,7 +1,7 @@
<article class="shadow float-on-hover card">
<div class="article-image">
<a href=" {{ .Permalink }}">
{{ $image := .Resources.GetMatch .Params.featured.url }}
{{ $image := .Resources.GetMatch "featured" }}
{{ partial "image.html" (dict "image" $image "alt" .Params.featured.alt "class" "fill-wh")}}
</a>
</div>

2
layouts/partials/article-meta.html

@ -16,7 +16,7 @@
<a class="small-text" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ end }}
{{ $image := (.Resources.GetMatch .Params.featured.url) }}
{{ $image := (.Resources.GetMatch "featured") }}
{{ partial "image.html" (dict "image" $image "alt" .Params.featured.alt "class" "shadow featured") }}
</section>

7
layouts/partials/image.html

@ -1,5 +1,5 @@
<img class="{{ .class }}"
{{ with .image }}
{{- with .image -}}
srcset="
{{- with (.Resize "600x q40") -}}
{{ printf "%s %dw," .RelPermalink .Width }}
@ -15,6 +15,7 @@
{{- with (.Resize "600x q40") -}}
{{ .RelPermalink }}
{{- end -}}"
{{ end }}
alt="{{ .alt }}"
alt="{{ .Params.alt }}"
{{- end -}}
>

Loading…
Cancel
Save