feat(helper/image): new return format

This commit is contained in:
Jimmy Cai
2020-09-11 16:01:01 +02:00
parent 3e18e165e0
commit cfd4cdb731
8 changed files with 30 additions and 35 deletions
+3 -3
View File
@@ -18,12 +18,12 @@
{{ $image := partial "helper/image" . }}
{{ if $image.exists }}
<div class="taxonomy-image">
{{ if $image.local }}
{{- $thumbnail := $image.src.Fill "120x120" -}}
{{ if $image.resource }}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}"
height="{{ $thumbnail.Height }}" loading="lazy">
{{ else }}
<img src="{{ $image.src }}" loading="lazy">
<img src="{{ $image.permalink }}" loading="lazy">
{{ end }}
</div>
{{ end }}