Merge pull request #2166 from ZhenShuo2021/feat/image-option

✨ Feat: add new option disableImageOptimizationMD
This commit is contained in:
Nuno Coração authored and GitHub committed 2025-05-27 00:37:23 +01:00
commit f316c9b437
6 files changed
+11 -6

No files matched your search

+2 -2
View File
@@ -20,7 +20,7 @@
{{- end }}
{{- end }}
{{- $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $disableImageOptimizationMD := .Page.Site.Params.disableImageOptimizationMD | default false }}
{{- $url := urls.Parse .Destination }}
{{- $altText := .Text }}
{{- $caption := .Title }}
@@ -36,7 +36,7 @@
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
{{- else if $resource }}
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
{{- $shouldOptimize := and (not $disableImageOptimization) (not $isSVG) }}
{{- $shouldOptimize := and (not $disableImageOptimizationMD) (not $isSVG) }}
{{- if $shouldOptimize }}
{{ template "RenderImageResponsive" (dict "resource" $resource "alt" $altText) }}
{{- else }}