1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-17 11:55:31 -04:00

make images linkable via shortcode param

This commit is contained in:
2020-04-23 12:43:43 -04:00
parent 60fd36001d
commit 2548b320fc
13 changed files with 72 additions and 72 deletions

View File

@@ -3,12 +3,18 @@
{{- with .Inner }}
<figure>
<picture>
{{ with $.Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}" title="{{ . | $.Page.RenderString | plainify | safeHTML }}">
{{ if $.Get "link" }}</a>{{ end }}
</picture>
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
</figure>
{{- else -}}
<p class="image"><img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}></p>
<p class="image">
{{ with .Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
</p>
{{- end }}