refactor: use helper/image in links.html (#1290)
* refactor: use `helper/image` in `links.html` * fix: check for $image existence before accessing
This commit is contained in:
@@ -14,14 +14,17 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ with $link.image }}
|
{{- $image := partial "helper/image" (dict "Image" $link.image "Resources" $.Resources) -}}
|
||||||
{{ $permalink := . }}
|
{{- with $image -}}
|
||||||
{{ with ($.Resources.GetMatch (printf "%s" (. | safeURL))) }}
|
|
||||||
{{ $permalink = .RelPermalink }}
|
|
||||||
{{ end }}
|
|
||||||
<div class="article-image">
|
<div class="article-image">
|
||||||
<img src="{{ $permalink }}" loading="lazy"{{ with $link.alt }} alt="{{ . }}"{{ end }}>
|
<img
|
||||||
|
src="{{ .Permalink }}"
|
||||||
|
loading="lazy"
|
||||||
|
{{ with $link.alt }} alt="{{ . }}"{{ end }}
|
||||||
|
{{ with .Width }} width="{{ . }}"{{ end }}
|
||||||
|
{{ with .Height }} height="{{ . }}"{{ end }}
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user