diff options
author | amzrk2 | 2020-07-24 09:17:09 +0800 |
---|---|---|
committer | amzrk2 | 2020-07-24 09:17:09 +0800 |
commit | 9897eff5d4fe78e26efd5e362cd32672575fae14 (patch) | |
tree | b0ecc5483044a81e8185a2606ded2084ea6b0db7 | |
parent | 3483f357ac417d7418461c01a5ab1cfc91816431 (diff) | |
download | hugo-theme-fuji-9897eff5d4fe78e26efd5e362cd32672575fae14.tar.gz hugo-theme-fuji-9897eff5d4fe78e26efd5e362cd32672575fae14.tar.bz2 hugo-theme-fuji-9897eff5d4fe78e26efd5e362cd32672575fae14.zip |
Fix image relative link issue
-rw-r--r-- | layouts/_default/_markup/render-image.html | 2 | ||||
-rw-r--r-- | layouts/shortcodes/img-lazy.html | 6 | ||||
-rw-r--r-- | layouts/shortcodes/img-nz-lazy.html | 12 | ||||
-rw-r--r-- | layouts/shortcodes/img-nz.html | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 397ff55..ab7aa31 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1 @@ -<img class="img-zoomable" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" /> +<img class="img-zoomable" src="{{ .Destination | relURL | safeURL }}" alt="{{ .Text }}" /> diff --git a/layouts/shortcodes/img-lazy.html b/layouts/shortcodes/img-lazy.html index a8927a5..bac255b 100644 --- a/layouts/shortcodes/img-lazy.html +++ b/layouts/shortcodes/img-lazy.html @@ -2,21 +2,21 @@ <img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholder | relURL }}" - data-src="{{ index .Params 1 }}" + data-src="{{ index .Params 1 | relURL | safeURL }}" alt="{{ index .Params 0 }}" /> {{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} <img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}" - data-src="{{ index .Params 2 }}" + data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" /> {{ else if eq (index .Params 0) "col" }} <img class="lazyload img-zoomable" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}" - data-src="{{ index .Params 2 }}" + data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" /> {{ else }}{{ end }}{{ else }}{{ end }} diff --git a/layouts/shortcodes/img-nz-lazy.html b/layouts/shortcodes/img-nz-lazy.html index a606f51..8a46329 100644 --- a/layouts/shortcodes/img-nz-lazy.html +++ b/layouts/shortcodes/img-nz-lazy.html @@ -2,21 +2,21 @@ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholder | relURL }}" - data-src="{{ index .Params 1 }}" + data-src="{{ index .Params 1 | relURL | safeURL }}" alt="{{ index .Params 0 }}" /> {{ else if len .Params | eq 3 }}{{ if eq (index .Params 0) "row" }} <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}" - data-src="{{ index .Params 2 }}" + data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" /> {{ else if eq (index .Params 0) "col" }} <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}" - data-src="{{ index .Params 2 }}" + data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" /> {{ else }} @@ -24,7 +24,7 @@ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholder | relURL }}" - data-src="{{ index .Params 1 }}" + data-src="{{ index .Params 1 | relURL | safeURL }}" alt="{{ index .Params 0 }}" /> </a> @@ -33,7 +33,7 @@ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderRow | relURL }}" - data-src="{{ index .Params 2 }}" + data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" /> </a> @@ -42,7 +42,7 @@ <img class="lazyload" src="{{ .Site.Params.lazyPlaceholderCol | relURL }}" - data-src="{{ index .Params 2 }}" + data-src="{{ index .Params 2 | relURL | safeURL }}" alt="{{ index .Params 1 }}" /> </a> diff --git a/layouts/shortcodes/img-nz.html b/layouts/shortcodes/img-nz.html index 30ea28a..2e4b3af 100644 --- a/layouts/shortcodes/img-nz.html +++ b/layouts/shortcodes/img-nz.html @@ -1,7 +1,7 @@ {{ if (index .Params 2) }} <a href="{{ index .Params 2 }}" target="_blank"> - <img src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> + <img src="{{ index .Params 1 | relURL | safeURL }}" alt="{{ index .Params 0 }}" /> </a> {{ else }} -<img src="{{ index .Params 1 }}" alt="{{ index .Params 0 }}" /> +<img src="{{ index .Params 1 | relURL | safeURL }}" alt="{{ index .Params 0 }}" /> {{ end }} |