From bc8df149251ad84ee8d0410711c29e642b74bc6d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 14 Aug 2026 12:20:07 -1000 Subject: Lazy load the avatar icons --- custom/extensions/email-gravatar.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'custom/extensions/email-gravatar.lua') diff --git a/custom/extensions/email-gravatar.lua b/custom/extensions/email-gravatar.lua index 6ce688f..3204ef1 100644 --- a/custom/extensions/email-gravatar.lua +++ b/custom/extensions/email-gravatar.lua @@ -95,6 +95,9 @@ function filter_write(text) buffer = buffer .. text end +-- A log page can carry one icon per commit, so the attributes let the +-- browser defer the fetches for icons still off screen and keep decoding +-- off the critical path. function filter_close() if avatar_hash == nil then html(buffer) @@ -104,7 +107,8 @@ function filter_close() "&d=" .. default_image .. "' width='" .. avatar_size .. "' height='" .. avatar_size .. - "' alt='" .. alt_text .. "' /> " .. buffer) + "' loading='lazy' decoding='async'" .. + " alt='" .. alt_text .. "'> " .. buffer) end return 0 end -- cgit v2.8.0