diff options
context:
space:
mode:
Diffstat (limited to 'custom/extensions')
-rw-r--r--custom/extensions/email-gravatar.lua6
-rw-r--r--custom/extensions/email-libravatar.lua6
2 files changed, 10 insertions, 2 deletions
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
diff --git a/custom/extensions/email-libravatar.lua b/custom/extensions/email-libravatar.lua
index ec35bc9..eceef56 100644
--- a/custom/extensions/email-libravatar.lua
+++ b/custom/extensions/email-libravatar.lua
@@ -92,6 +92,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)
@@ -101,7 +104,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