* refactor: use `helper/image` in `links.html` * fix: check for $image existence before accessing
33 lines
1.3 KiB
HTML
33 lines
1.3 KiB
HTML
<div class="article-list--compact links">
|
|
{{ range $i, $link := .Params.links }}
|
|
<article>
|
|
<a href="{{ $link.website }}" target="_blank" rel="noopener">
|
|
<div class="article-details">
|
|
<h2 class="article-title">
|
|
{{- $link.title -}}
|
|
</h2>
|
|
<footer class="article-footer">
|
|
{{ with $link.description }}
|
|
{{ . }}
|
|
{{ else }}
|
|
{{ $link.website }}
|
|
{{ end }}
|
|
</footer>
|
|
</div>
|
|
|
|
{{- $image := partial "helper/image" (dict "Image" $link.image "Resources" $.Resources) -}}
|
|
{{- with $image -}}
|
|
<div class="article-image">
|
|
<img
|
|
src="{{ .Permalink }}"
|
|
loading="lazy"
|
|
{{ with $link.alt }} alt="{{ . }}"{{ end }}
|
|
{{ with .Width }} width="{{ . }}"{{ end }}
|
|
{{ with .Height }} height="{{ . }}"{{ end }}
|
|
>
|
|
</div>
|
|
{{ end }}
|
|
</a>
|
|
</article>
|
|
{{ end }}
|
|
</div> |