Make thumbnail image clickable on list partial

This commit is contained in:
vimux 2018-11-17 14:09:57 -05:00
parent 6b3d4c831c
commit 290d1cb0ae
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
3 changed files with 11 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<article class="post card__box block"> <article class="post card__box block">
{{- partial "post_thumbnail.html" (dict "page" . ) }} {{- partial "post_thumbnail.html" (dict "page" . "link" .RelPermalink) }}
<h1 class="post__title title-excerpt"><a class="post__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1> <h1 class="post__title title-excerpt"><a class="post__title-link" href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
<div class="post__content">{{- .Summary }}</div> <div class="post__content">{{- .Summary }}</div>
{{- partial "post_meta.html" (dict "dot" . "class" "mt tar") }} {{- partial "post_meta.html" (dict "dot" . "class" "mt tar") }}

View file

@ -1,6 +1,13 @@
{{- $img := (.page.Resources.ByType "image").GetMatch "thumbnail.*" }} {{- $img := (.page.Resources.ByType "image").GetMatch "thumbnail.*" }}
{{- $link := .link }}
{{- with $img }} {{- with $img }}
<figure class="post__thumbnail thumbnail"> <figure class="post__thumbnail thumbnail">
{{- with $link }}
<a class="thumbnail__link" href="{{ . }}">
<img class="thumbnail__img" src="{{ $img.RelPermalink }}" alt="{{ $img.Title }}"> <img class="thumbnail__img" src="{{ $img.RelPermalink }}" alt="{{ $img.Title }}">
</a>
{{- else }}
<img class="thumbnail__img" src="{{ $img.RelPermalink }}" alt="{{ $img.Title }}">
{{- end }}
</figure> </figure>
{{- end }} {{- end }}