Browse Source

Fix a bug with the img shortcode.

master
Syfaro 1 year ago
parent
commit
dca219ba91
1 changed files with 15 additions and 5 deletions
  1. +15
    -5
      layouts/shortcodes/img.html

+ 15
- 5
layouts/shortcodes/img.html View File

@@ -1,6 +1,16 @@
{{ $img := $.Page.Resources.GetMatch (.Get 0)}}
{{ $images := .Page.Resources.ByType "image" }}

<figure>
<img src="{{ $img.RelPermalink }}" alt="(.Get 1)" />
<figcaption>{{ .Get 1 }}</figcaption>
</figure>
{{ $img := $images.GetMatch (.Get 0)}}

{{ if ne $img.MediaType.SubType "svg" }}
{{ $img = $img.Resize "800x" }}
{{ end }}

{{ with (.Get 1) }}
<figure>
<img src="{{ $img.RelPermalink }}" alt="{{ . }}" />
<figcaption>{{ . }}</figcaption>
</figure>
{{ else }}
<img src="{{ $img.RelPermalink }}" />
{{ end }}

Loading…
Cancel
Save