Make the largest element on the page load faster on Vercel
Why it matters
Largest Contentful Paint is how long visitors wait before the main image or heading shows, and a poor value means many of them wait too long. Google counts this in its page experience signals and slow pages lose visitors.
Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.
The fix
- Vercel serves your static files from its edge network. Files that your framework fingerprints (Next.js does this for its built assets) are already cached for a long time.
- For your own static assets in a folder such as /assets, add a header rule with a long lifetime, but only if the file names change when their content changes. Mark the hero image with the framework's priority image option or with fetchpriority.
vercel.json
{ "headers": [ { "source": "/assets/(.*)", "headers": [ { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" } ] } ] }
Related
- Reported by the Core Web Vitals check
- Make the largest element on the page load faster
- Stop the page layout from jumping while it loads
- Stop the page layout from jumping while it loads
- Make the page respond faster to clicks and taps
- Make the page respond faster to clicks and taps
- Reduce the JavaScript that blocks the page while it loads
- Reduce the JavaScript that blocks the page while it loads
- Collect real-user speed data for your site
Scan your domain to see whether this applies to you.