diff options
author | uPagge <git@upagge.ru> | 2021-02-24 15:20:21 +0300 |
---|---|---|
committer | uPagge <git@upagge.ru> | 2021-02-24 15:20:21 +0300 |
commit | cd2a0b775fd958f90c45c9d801748bc8817910b1 (patch) | |
tree | b55f44cb7aa1d4ee6ecf96334c5298ec1c2a30a1 /layouts/_default/_markup | |
parent | e8a562b5d1a74c6e4136e34516e1dead90300da0 (diff) |
lazy
Diffstat (limited to 'layouts/_default/_markup')
-rw-r--r-- | layouts/_default/_markup/render-image.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index e6ffb9d..a63c2a3 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -5,13 +5,27 @@ {{ $caption = " " }} {{- end -}} +{{ $imageOriginal := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) }} +{{ $imagePlug := "" }} +{{ with $imageOriginal }} +{{ $imagePlug = .Resize "400x jpg q10" }} +{{ end }} + {{- if $figcap -}} <figure> + {{ if ne $imageOriginal nil }} + {{- dict "Src" .Destination "Title" $figcap "Alt" $alt "Caption" $caption "Linked" true "Resources" .Page.Resources "ImagePlug" $imagePlug.RelPermalink | partial "plugin/image.html" -}} + {{ else }} {{- dict "Src" .Destination "Title" $figcap "Alt" $alt "Caption" $caption "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}} + {{ end }} <figcaption class="image-caption"> {{- $figcap | safeHTML -}} </figcaption> </figure> {{- else -}} +{{ if ne $imageOriginal nil }} +{{- dict "Src" .Destination "Title" (path.Base .Destination) "Alt" $alt "Resources" .Page.Resources "ImagePlug" $imagePlug.RelPermalink | partial "plugin/image.html" -}} +{{ else }} {{- dict "Src" .Destination "Title" (path.Base .Destination) "Alt" $alt "Resources" .Page.Resources | partial "plugin/image.html" -}} +{{ end }} {{- end -}} |