Browse Source

using image.html partial in authors/list.html; resize image in article-alt.html

Alexander Avery 3 weeks ago
parent
commit
715a99dbaf
  1. 9
      layouts/authors/list.html
  2. 3
      layouts/partials/article-alt.html

9
layouts/authors/list.html

@ -1,8 +1,13 @@
{{ define "main" }}
<section>
{{- with .Resources.GetMatch "avatar" }}
<img class="shadow author" src="{{ .RelPermalink }}" alt="{{ .Params.alt }}"/>
{{- with (.Resources.GetMatch "avatar") }}
{{- partial "image.html"
(dict
"image" .
"alt" .Params.alt
"sizes" (slice 320 500)
"classes" (slice "shadow" "author")) }}
{{- end }}
<div>

3
layouts/partials/article-alt.html

@ -11,10 +11,11 @@ Renders an article card with a circle image, title, and summary.
{{- $title := .title }}
{{- $summary := .summary }}
{{- $url := .url }}
{{- $img := ($image.Resize "256x webp q90") }}
<a href="{{ $url }}">
<article class="alt float-on-hover shadow">
<div>
<img src="{{ $image.RelPermalink }}" alt="{{ $alt }}" />
<img src="{{ $img.RelPermalink }}" alt="{{ $alt }}" />
</div>
<div>
<h2>{{ $title }}</h2>

Loading…
Cancel
Save