How can I add decoding="async" attribute to all img?

How can I add decoding=“async” attribute to all img? Is there a plugin or other way to do this?

<img decoding="async" src="/img.jpg" alt="">

I imagine you are talking about how to add attributes with markdown syntax, something like that should work:

![Alt title](/img.jpg){: decoding="async"}

thx, but I meant a way to insert it automatically, like the loading=lazy attribute in the plugin jekyll-loading-lazy

Well if that plugin is working for you, just rework it…

  1. copy and paste the file lib/jekyll-loadling-lazy.rb file under your _plugins folder;
  2. load it in your config.yml file and remove any reference of the gem from your Gemfile (if you was using it as gem);
  3. append after the line (or simply comment it if you don’t need the lazy loading attribute):
 tags.each { |tag| tag["loading"] = "lazy" unless tag["loading"] }

this one:

 tags.each { |tag| tag["decoding"] = "async" unless tag["decoding"] }

it should work!