From 3d37733af99e0c13ca62473deb2908990c7970f2 Mon Sep 17 00:00:00 2001 From: blankie Date: Sun, 9 Apr 2023 12:38:45 +0700 Subject: [PATCH] Lazy load images --- routes/users/common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/users/common.cpp b/routes/users/common.cpp index a0e2480..0cc5865 100644 --- a/routes/users/common.cpp +++ b/routes/users/common.cpp @@ -11,7 +11,7 @@ Element generate_user_header(const User& user, const Config& config) { std::string cover_original = proxy_image_url(config, user.cover_images->original_or_thumbnail()); std::string cover_thumbnail = proxy_image_url(config, user.cover_images->thumbnail_or_original()); header.nodes.push_back(Element("a", {{"href", std::move(cover_original)}}, { - Element("img", {{"class", "cover"}, {"src", std::move(cover_thumbnail)}}, {}) + Element("img", {{"class", "cover"}, {"loading", "lazy"}, {"src", std::move(cover_thumbnail)}}, {}) })); } @@ -19,7 +19,7 @@ Element generate_user_header(const User& user, const Config& config) { std::string profile_picture_thumbnail = proxy_image_url(config, user.profile_pictures.thumbnail_or_original()); header.nodes.push_back(Element("div", {{"class", "usermetadata"}}, { Element("a", {{"href", std::move(profile_picture_original)}}, { - Element("img", {{"class", "profilepicture"}, {"src", std::move(profile_picture_thumbnail)}}, {}) + Element("img", {{"class", "profilepicture"}, {"loading", "lazy"}, {"src", std::move(profile_picture_thumbnail)}}, {}) }), Element("div", { Element("p", {Element("b", {user.display_name}), " (@", user.username, ")"}),