diff options
Diffstat (limited to 'themes/blowfish/layouts/_default/_markup')
-rw-r--r-- | themes/blowfish/layouts/_default/_markup/render-image.html | 38 | ||||
-rw-r--r-- | themes/blowfish/layouts/_default/_markup/render-link.html | 9 |
2 files changed, 26 insertions, 21 deletions
diff --git a/themes/blowfish/layouts/_default/_markup/render-image.html b/themes/blowfish/layouts/_default/_markup/render-image.html index db9ebd2..3e5fdce 100644 --- a/themes/blowfish/layouts/_default/_markup/render-image.html +++ b/themes/blowfish/layouts/_default/_markup/render-image.html @@ -1,29 +1,29 @@ -{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} -{{ $url := urls.Parse .Destination }} -{{ $altText := .Text }} -{{ $caption := .Title }} -{{ if findRE "^https?" $url.Scheme }} +{{- $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} +{{- $url := urls.Parse .Destination }} +{{- $altText := .Text }} +{{- $caption := .Title }} +{{- if findRE "^https?" $url.Scheme }} <figure> <img class="my-0 rounded-md" loading="lazy" src="{{ $url.String }}" alt="{{ $altText }}" /> {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} </figure> -{{ else }} - {{ $resource := "" }} - {{ if $.Page.Resources.GetMatch ($url.String) }} - {{ $resource = $.Page.Resources.GetMatch ($url.String) }} - {{ else if resources.GetMatch ($url.String) }} - {{ $resource = resources.Get ($url.String) }} - {{ end }} - {{ with $resource }} +{{- else }} + {{- $resource := "" }} + {{- if $.Page.Resources.GetMatch ($url.String) }} + {{- $resource = $.Page.Resources.GetMatch ($url.String) }} + {{- else if resources.GetMatch ($url.String) }} + {{- $resource = resources.Get ($url.String) }} + {{- end }} + {{- with $resource }} <figure> - {{ if $disableImageOptimization }} + {{- if or $disableImageOptimization (eq .MediaType.SubType "svg")}} <img class="my-0 rounded-md" loading="lazy" src="{{ .RelPermalink }}" alt="{{ $altText }}" /> - {{ else }} + {{- else }} <img class="my-0 rounded-md" loading="lazy" @@ -35,13 +35,13 @@ src="{{ (.Resize "660x").RelPermalink }}" alt="{{ $altText }}" /> - {{ end }} + {{- end }} {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} </figure> - {{ else }} + {{- else }} <figure> <img class="my-0 rounded-md" loading="lazy" src="{{ $url.String }}" alt="{{ $altText }}" /> {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} </figure> - {{ end }} -{{ end }} + {{- end }} +{{- end }} diff --git a/themes/blowfish/layouts/_default/_markup/render-link.html b/themes/blowfish/layouts/_default/_markup/render-link.html index 8336169..b6028bf 100644 --- a/themes/blowfish/layouts/_default/_markup/render-link.html +++ b/themes/blowfish/layouts/_default/_markup/render-link.html @@ -1,2 +1,7 @@ -<a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{ . }}"{{ end }} {{ if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}> - {{ .Text | safeHTML }}</a>
\ No newline at end of file +<a href="{{ .Destination | safeURL }}" + {{- with .Title -}} + title="{{ . }}" + {{- end }} + {{- if or (strings.HasPrefix .Destination "http:") (strings.HasPrefix .Destination "https:") }} target="_blank"{{ end }}> + {{- .Text | safeHTML -}} +</a>
\ No newline at end of file |