Files
hugo-theme-stack/layouts/_partials/article/components/links.html
T
JimmyandGitHub a95d0e7c85 refactor: use helper/image in links.html (#1290)
* refactor: use `helper/image` in `links.html`

* fix: check for $image existence before accessing
2026-03-05 13:51:34 +01:00

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>