feat: add new option disableImageOptimizationMD

This commit is contained in:
ZhenShuo Leo
2025-05-27 04:19:51 +08:00
parent 86fa25f27f
commit 69fc96ed5b
6 changed files with 11 additions and 6 deletions

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 }}