From 99899b063a025a4d7dfd49d089443386bbe855bb Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Thu, 29 Feb 2024 07:26:48 +0800 Subject: [PATCH] fix: use RelPermalink instead of Permalink (#43) --- hugo.toml | 2 +- layouts/partials/images/image.html | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hugo.toml b/hugo.toml index 94dfec7..b8a7761 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,5 +1,5 @@ [module.hugoVersion] -min = "0.119.0" +min = "0.123.5" [params.hugomods.images] class_name = "img-fluid" diff --git a/layouts/partials/images/image.html b/layouts/partials/images/image.html index 01ed2d9..5fb2da8 100644 --- a/layouts/partials/images/image.html +++ b/layouts/partials/images/image.html @@ -60,9 +60,7 @@ {{- $res = $page.Resources.GetMatch $path }} {{- end }} {{- with $res }} - {{/* TODO: use Permalink instead, since the fingerprint resources will not published to other sites. */}} - {{/* See https://github.com/hugomods/images/issues/23. */}} - {{- $originalSrc = ($res | fingerprint "md5").Permalink }} + {{- $originalSrc = ($res | fingerprint "md5").RelPermalink }} {{- $originalWidth = $res.Width }} {{- $originalHeight = $res.Height }} {{/* Check if the image resource is valid. */}} @@ -148,14 +146,10 @@ {{/* Modern format. */}} {{- if and $modernFormat (ne $modernFormat $res.MediaType.SubType) (in $formats $res.MediaType.SubType) }} {{- $modernImg := partial "images/functions/format" (dict "Img" $res "Format" $modernFormat) }} - {{/* TODO: use Permalink instead, since the processed resources will not published to other sites. */}} - {{/* See https://github.com/gohugoio/hugo/issues/12110. */}} - {{- $sources = $sources | append (dict "srcset" $modernImg.Permalink "type" $modernImg.MediaType) }} + {{- $sources = $sources | append (dict "srcset" $modernImg.RelPermalink "type" $modernImg.MediaType) }} {{- end }} {{/* Reset image properties. */}} - {{/* TODO: use Permalink instead, since the fingerprint resources will not published to other sites. */}} - {{/* See https://github.com/hugomods/images/issues/23. */}} - {{- $src = ($res | fingerprint "md5").Permalink }} + {{- $src = ($res | fingerprint "md5").RelPermalink }} {{- $height = $res.Height }} {{- $naturalHeight = $res.Height }} {{- $width = $res.Width }}