Skip to content

Commit

Permalink
🔀 Merge pull request jpanther#508 from uschmidt83/patch-1
Browse files Browse the repository at this point in the history
🐛 Fix broken `srcset` links when using hugo with `--minify` option
  • Loading branch information
jpanther authored Mar 29, 2023
2 parents 8684e60 + 5fae5fe commit 11315cd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
src="{{ .RelPermalink }}"
{{ else }}
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
{{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w,
{{- (.Resize "1024x").RelPermalink }} 1024w,
{{- (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
{{ end }}
{{ end }}
Expand Down
11 changes: 6 additions & 5 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
{{ if lt .Width 660 }}
src="{{ .RelPermalink }}"
{{ else }}
srcset=" {{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w, {{ (.Resize "1024x").RelPermalink }}
1024w, {{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
{{ end }}
srcset="
{{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w,
{{- (.Resize "1024x").RelPermalink }} 1024w,
{{- (.Resize "1320x").RelPermalink }} 2x"
{{ end }}
{{ end }}
alt="{{ $.Params.featureAlt | default $.Params.coverAlt | default "" }}"
/>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/article-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
sm:max-w-[10rem]" src="{{ .RelPermalink }}"
{{ else }}
class="w-24 rounded-md sm:w-40" srcset="
{{- (.Fill "160x120 smart").RelPermalink }}
160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x"
{{- (.Fill "160x120 smart").RelPermalink }} 160w,
{{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}"
{{ end }}
/>
Expand Down
8 changes: 4 additions & 4 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
src="{{ .RelPermalink }}"
{{ else }}
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
{{- (.Resize "330x").RelPermalink }} 330w,
{{- (.Resize "660x").RelPermalink }} 660w,
{{- (.Resize "1024x").RelPermalink }} 1024w,
{{- (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
{{ end }}
{{ end }}
Expand Down

0 comments on commit 11315cd

Please sign in to comment.