featured-image.html 612 B

1234567891011121314
  1. {{ $w := .w | default 480 }}
  2. {{ $h := .h | default 180 }}
  3. {{ $p := .p }}
  4. {{ $class := .class | default "ms-3" }}
  5. {{ $image := ($p.Resources.ByType "image").GetMatch "**featured*" }}
  6. {{ with $image }}
  7. {{ $image := .Fill (printf "%dx%d" $w $h ) }}
  8. <figure class="{{ $class }}" style="width: {{ $image.Width }}px">
  9. <img src="{{ $image.RelPermalink }}" alt="Featured Image for {{ $p.Title }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
  10. {{ with $image.Params.byline }}
  11. <figcaption class="mt-2 mt-md-0"><small class="text-body-secondary">{{ . | html }}</small></figcaption>
  12. {{ end }}
  13. </figure>
  14. {{ end }}