Skip to content

Commit

Permalink
fix: use RelPermalink instead of Permalink (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Feb 28, 2024
1 parent fc13e5f commit 99899b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion hugo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[module.hugoVersion]
min = "0.119.0"
min = "0.123.5"

[params.hugomods.images]
class_name = "img-fluid"
Expand Down
12 changes: 3 additions & 9 deletions layouts/partials/images/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -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. */}}
Expand Down Expand Up @@ -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 }}
Expand Down

3 comments on commit 99899b0

@pleasantone
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to bump the Hugo version to 1.23.5?

@razonyang
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pleasantone yes, since there is bugfix for this in 0.123.5, just ignore it if you don't have multihost setup.

@pleasantone
Copy link

@pleasantone pleasantone commented on 99899b0 Feb 29, 2024 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.