fix: use page resource permalink in link image (#990)

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/982
This commit is contained in:
Jimmy Cai 2024-03-27 10:58:22 +01:00 committed by GitHub
parent 54a8ace564
commit 23607527e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,8 +16,12 @@
</div> </div>
{{ with $link.image }} {{ with $link.image }}
{{ $permalink := . }}
{{ with ($.Resources.GetMatch (printf "%s" (. | safeURL))) }}
{{ $permalink = .RelPermalink }}
{{ end }}
<div class="article-image"> <div class="article-image">
<img src="{{ . }}" loading="lazy"> <img src="{{ $permalink }}" loading="lazy">
</div> </div>
{{ end }} {{ end }}
</a> </a>