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" }} {{ define "main" }}
<section> <section>
{{- with .Resources.GetMatch "avatar" }} {{- with (.Resources.GetMatch "avatar") }}
<img class="shadow author" src="{{ .RelPermalink }}" alt="{{ .Params.alt }}"/> {{- partial "image.html"
(dict
"image" .
"alt" .Params.alt
"sizes" (slice 320 500)
"classes" (slice "shadow" "author")) }}
{{- end }} {{- end }}
<div> <div>

3
layouts/partials/article-alt.html

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

Loading…
Cancel
Save