feat(helper/image): new image helper (WIP)
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
<article class="{{ if .context.Params.image }}has-image{{ end }}">
|
||||
{{ $image := partial "helper/image" .context }}
|
||||
<article class="{{ if $image.exists }}has-image{{ end }}">
|
||||
<a href="{{ .context.Permalink }}">
|
||||
{{ if .context.Params.image }}
|
||||
{{- $image := partial "helper/image" .context | resources.Fingerprint "md5" -}}
|
||||
{{- $thumbnail := $image.Fill .size -}}
|
||||
<div class="article-image">
|
||||
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}"
|
||||
loading="lazy" data-key="{{ .context.Slug }}" data-hash="{{ $image.Data.Integrity }}">
|
||||
</div>
|
||||
|
||||
{{ if $image.exists }}
|
||||
<div class="article-image">
|
||||
{{ if $image.local }}
|
||||
{{- $imageRaw := $image.src | resources.Fingerprint "md5" -}}
|
||||
{{- $thumbnail := $imageRaw.Fill .size -}}
|
||||
|
||||
<img src="{{ $thumbnail.RelPermalink }}" width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}"
|
||||
loading="lazy" data-key="{{ .context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">
|
||||
{{ else }}
|
||||
<img src="{{ $image.src }}" loading="lazy" data-key="{{ .context.Slug }}" data-hash="{{ $image.src }}"/>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="article-details">
|
||||
|
||||
Reference in New Issue
Block a user