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

View File

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

View File

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

View File

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

View File

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