refactoring

pull/693/head
stereobooster 2023-11-26 14:47:26 +01:00
parent 0c6c30fec1
commit c8b33ae51e
6 changed files with 8 additions and 16 deletions

View File

@ -20,7 +20,7 @@
<figure> <figure>
{{- with $img -}} {{- with $img -}}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }} {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }}
{{- else -}} {{- else -}}
<img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/> <img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/>
{{- end -}} {{- end -}}

View File

@ -17,7 +17,7 @@
<div class="prose"> <div class="prose">
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }} {{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }}
{{ $class := "mb-6 -mt-4 rounded-md" }} {{ $class := "mb-6 -mt-4 rounded-md" }}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }} {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }}
{{ with $.Params.coverCaption }} {{ with $.Params.coverCaption }}
<figcaption class="mb-6 -mt-3 text-center">{{ . | markdownify }}</figcaption> <figcaption class="mb-6 -mt-3 text-center">{{ . | markdownify }}</figcaption>
{{ end }} {{ end }}

View File

@ -1,10 +1,10 @@
{{ $img := .img }} {{ $img := .img }}
{{ $alt := .alt }} {{ $alt := .alt }}
{{ $class := .class }} {{ $class := .class }}
{{ $lazy := .lazy }} {{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := .webp }} {{ $webp := .webp | default $.Page.Site.Params.enableImageWebp | default true }}
{{ $lqip := .lqip }} {{ $lqip := .lqip | default false }}
{{ $x2 := .x2 }} {{ $x2 := .x2 | default false }}
{{ with $img }} {{ with $img }}
{{ if (eq .MediaType.SubType "svg") }} {{ if (eq .MediaType.SubType "svg") }}

View File

@ -1,8 +0,0 @@
{{ $img := .img }}
{{ $alt := .alt }}
{{ $class := .class }}
{{ $lazy := .lazy | default $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := $.Page.Site.Params.enableImageWebp | default true }}
{{ $lqip := false }}
{{ $x2 := .x2 }}
{{ partial "picture.html" (dict "img" $img "alt" $alt "class" $class "lazy" $lazy "webp" $webp "lqip" $lqip "x2" $x2) }}

View File

@ -18,7 +18,7 @@
{{ with $href }}<a href="{{ . }}">{{ end }} {{ with $href }}<a href="{{ . }}">{{ end }}
{{- with $img -}} {{- with $img -}}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }} {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class) }}
{{- else -}} {{- else -}}
<img src="{{ $url.String }}" alt="{{ $altText }}" class="{{ $class }}"/> <img src="{{ $url.String }}" alt="{{ $altText }}" class="{{ $class }}"/>
{{- end -}} {{- end -}}

View File

@ -12,7 +12,7 @@
{{ $altText = (.Get "caption") | markdownify | plainify }} {{ $altText = (.Get "caption") | markdownify | plainify }}
{{ end }} {{ end }}
{{ partial "pictureDefaults.html" (dict "img" $image "alt" $altText "x2" true) }} {{ partial "picture.html" (dict "img" $image "alt" $altText "x2" true) }}
{{- if .Get "href" }}</a>{{ end -}} {{- if .Get "href" }}</a>{{ end -}}
{{- if .Get "caption" -}} {{- if .Get "caption" -}}