4 ms·
Google Lighthouse recommends not embedding YouTube videos directly
- unsnap_biceps 2y agoI wonder how much bandwidth YouTube would save if a sizable amount of sites followed the advice.
- pier25 2y agoI'm sure youtube is totally fine with the bandwidth costs considering their embeddable player is made for tracking and advertisement.
- tuananh 2y agoThis is how you do it with Hugo https://tuananh.net/2025/02/13/lite-youtube-embed-for-hugo/ https://tuananh.net/2025/02/13/lite-youtube-embed-for-hugo/
- faraixyz 2y agoI’ve done this too https://its.ffg.co.zw/bikeshed/components/lite-yt/ https://its.ffg.co.zw/bikeshed/components/lite-yt/ I’d recommend using HasShortcode in the head so the script is only loaded if the post has a shortcode. Also, use {{/* and */}} to stop Hugo from trying to render a template tag so you can include it in a code snippet.
- CSSer 2y agoI’ve always wondered why the embeds don’t do this asynchronously themselves, either as a default or with a flag. The amount of resources these embeds automatically consume is egregious. It seems so odd to tell the world to apply a fix for a platform you own.
- youngtaff 2y agoSome YouTube PM’s promotion is probably dependent on the data they get from all the embeds and lazy-loading them would affect that So YT have no motivation to address the issue, you see the same thing across all of Google’s other embeds too While the Chrome team may care about front end performance there’s little evidence the rest of Google do
- kweks 2y agoBetter alternative : https://github.com/justinribeiro/lite-youtube https://github.com/justinribeiro/lite-youtube
- egberts1 2y agoWow, was a user of Lighthouse 10y ago, never heard of it again after I changed job, now Google owns it! It was good then.
- Tyriar 2y agoI think it was always a Google product https://github.com/GoogleChrome/lighthouse/tree/9ff34c320811b764040815ac5264d8ced7b13c55 https://github.com/GoogleChrome/lighthouse/tree/9ff34c320811.... If I remember right it was an evolution of the page speed test site (can't remember exact name) of which Google was also a contributor to. There's plenty that can be said about Google, but investing in education and testing around web performance was one of their stand out achievements imo.