🛠 fix: Syntax error

pull/552/head
Tomy Hsieh 2023-05-27 05:37:02 +08:00
parent 88c73a3aae
commit 0d4fe03a45
No known key found for this signature in database
GPG Key ID: 4E6AF0EEDD2205F8
5 changed files with 8 additions and 7 deletions

View File

@ -1,13 +1,14 @@
{{ $url := urls.Parse .Destination }} {{ $url := urls.Parse .Destination }}
{{ $altText := .Text }} {{ $altText := .Text }}
{{ $caption := .Title }} {{ $caption := .Title }}
{{ $lazyLoad := $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ if findRE "^https?" $url.Scheme }} {{ if findRE "^https?" $url.Scheme }}
<figure> <figure>
<img <img
class="mx-auto my-0 rounded-md" class="mx-auto my-0 rounded-md"
src="{{ $url.String }}" src="{{ $url.String }}"
alt="{{ $altText }}" alt="{{ $altText }}"
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $lazyLoad }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />
@ -39,7 +40,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
alt="{{ $altText }}" alt="{{ $altText }}"
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $lazyLoad }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />
@ -51,7 +52,7 @@
class="mx-auto my-0 rounded-md" class="mx-auto my-0 rounded-md"
src="{{ $url.String }}" src="{{ $url.String }}"
alt="{{ $altText }}" alt="{{ $altText }}"
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $lazyLoad }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />

View File

@ -31,7 +31,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
alt="{{ $.Params.featureAlt | default $.Params.coverAlt | default "" }}" alt="{{ $.Params.featureAlt | default $.Params.coverAlt | default "" }}"
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />

View File

@ -23,7 +23,7 @@
160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x" 160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}" src="{{ (.Fill "160x120 smart").RelPermalink }}"
{{ end }} {{ end }}
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />

View File

@ -10,7 +10,7 @@
height="96" height="96"
alt="{{ $.Site.Author.name | default "Author" }}" alt="{{ $.Site.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}" src="{{ $authorImage.RelPermalink }}"
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />

View File

@ -14,7 +14,7 @@
height="144" height="144"
alt="{{ $.Site.Author.name | default "Author" }}" alt="{{ $.Site.Author.name | default "Author" }}"
src="{{ $authorImage.RelPermalink }}" src="{{ $authorImage.RelPermalink }}"
{{ if .Site.Params.enableImageLazyLoading | default true }} {{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy" loading="lazy"
{{ end }} {{ end }}
/> />