79400087

Date: 2025-01-30 13:40:13
Score: 1
Natty:
Report link

After a bit of research, it seems that the [imaging] parameter does not apply to images in page bundle.

However, using image processing features as suggested by @bogdanoff worked nicely.

To do so, I modified the default render hook for images like so

File layouts/_default/_markup/render-image.html

{{ $original := .Destination }}
{{ $resource := .Page.Resources.GetMatch $original }}

{{ if $resource }}
  {{ $optimized := $resource.Resize "800x webp q75" }}
  <img src="{{ $optimized.RelPermalink }}" alt="{{ .Text }}">
{{ else }}
  <img src="{{ $original }}" alt="{{ .Text }}">
{{ end }}

This allow to automatically resize the images that come from page bundles, and to display other images (urls, /static) without resizing.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @bogdanoff
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Hugo REYMOND