Skip to content

Documentation: Lazy loading via HTML attribute on <img> #329

@u451f

Description

@u451f

Hi!

In the documentation I saw that lazy-loading "using an appropriate javascript library" is suggested. Nowadays <img> can take loading="lazy" as attribute, see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#lazy No JS needed.

In _data/picture.yml I have thus created a"default" preset, like so:

presets:
  default:
    formats: [webp, original]
    attributes:
      img: 'loading="lazy"'

Maybe that could be added as a default as it's supposed to save loading time or could be added to the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions