Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat: Lazy load image by default #552

Merged
merged 6 commits into from
Jun 4, 2023

Conversation

tomy0000000
Copy link
Contributor

Make lazy loading images by default to reduce the load time on pages with many pictures.

@netlify
Copy link

netlify bot commented May 8, 2023

Deploy Preview for hugo-congo ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 16c56d2
🔍 Latest deploy log https://app.netlify.com/sites/hugo-congo/deploys/64712ad73bd8070007affba2
😎 Deploy Preview https://deploy-preview-552--hugo-congo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jpanther
Copy link
Owner

Thanks for the PR. I do wonder if this is something that should be added as a configurable parameter? Also, is there a reason you chose to only apply lazy loading to the markdown rendering template and not in other areas like the figure partial?

@jpanther jpanther added the enhancement New feature or request label May 25, 2023
@tomy0000000
Copy link
Contributor Author

I do wonder if this is something that should be added as a configurable parameter?

Sounds reasonable, should probably work on this.

is there a reason you chose to only apply lazy loading to the markdown rendering template and not in other areas like the figure partial?

Not really, that's my mistake in missing those, which should be set to lazy-load, too.

Seems like we need to work on this more to support, I'll try to find some time.

@tomy0000000
Copy link
Contributor Author

@jpanther I think this is ready to go!

@jpanther
Copy link
Owner

jpanther commented Jun 4, 2023

Thanks for the changes, I think this is now a complete implementation and am happy to merge it in. It will be included in the next theme release.

@jpanther jpanther merged commit 4138925 into jpanther:dev Jun 4, 2023
@tomy0000000 tomy0000000 deleted the lazy-load-image-by-default branch June 5, 2023 13:58
@ghost
Copy link

ghost commented Jun 25, 2023

Welcome to getting moaned at by GTMetrix (Don't lazy load Largest Contentful Paint image) and Pagespeed (Largest Contentful Paint image was lazily loaded) for lazy loading. Above the fold shouldn't be lazy loaded, it actually just looks weird , and shifts text down when it appears.

Better would be to not lazy load cover or featured image, then load rest - or make it option. none/all/notcover?

@jpanther
Copy link
Owner

Thanks @hystedm. I've opened a new issue #591 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants