Merge pull request #2532 from ZhenShuo2021/fix/render-image

🐛 Fix(render-image): correct srcset and HTML structure
This commit is contained in:
Nuno C.
2025-10-14 10:07:52 +01:00
committed by GitHub
4 changed files with 110 additions and 47 deletions

View File

@@ -31,14 +31,18 @@
{{- else }}
<img
class="my-0 rounded-md{{ with $nozoom }} nozoom{{ end }}{{ with $class }} {{ . }}{{ end }}"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
data-zoom-src="{{ (.Resize "1320x").RelPermalink }}"
loading="lazy"
decoding="async"
fetchpriority="auto"
alt="{{ $altText }}"
{{ with .Width }}width="{{ . }}"{{ end }}
{{ with .Height }}height="{{ . }}"{{ end }}
src="{{ (.Resize "800x").RelPermalink }}"
srcset="
{{- (.Resize "800x").RelPermalink }} 800w,
{{- (.Resize "1280x").RelPermalink }} 1280w"
sizes="(min-width: 768px) 50vw, 65vw"
data-zoom-src="{{ .RelPermalink }}"
/>
{{- end }}
{{- else }}