Images, fonts, scripts and SEO · mid
next/image, next/font and next/script
next/image serves resized modern-format images with reserved space and lazy loading, next/font self-hosts fonts with fallback metrics so text does not shift, and next/script controls when third-party scripts load; together they protect LCP, CLS and INP.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Images: give
width/height(orfill+ a sized parent) so space is reserved (no CLS); addsizeswith responsive layouts so phones do not download desktop images. - Images are lazy by default. For the LCP image: in Next 16 the
priorityprop is deprecated; usepreload(adds a<link rel="preload">) or, in most cases,loading="eager"/fetchPriority="high". - Next 16 image defaults:
qualitiesis[75](otherqualityvalues are coerced),minimumCacheTTL4 hours, size 16 removed fromimageSizes, local IPs blocked (dangerouslyAllowLocalIP), max 3 redirects,localPatternsneeded for localsrcwith query strings.images.domainsis deprecated: useremotePatterns. - Self-hosting: optimisation uses
sharpon your server (CPU and memory); a CDN loader can take that load. next/font/googleandnext/font/local: fonts are downloaded at build and served from your domain (no browser requests to Google), with automatic fallback metrics so swapping fonts does not shift layout. Prefer variable fonts; setsubsets; define in the root layout; expose as a CSS variable for Tailwind.next/scriptstrategies:beforeInteractive(root layout only, critical),afterInteractive(default),lazyOnload(idle).onLoad/onReadyneed a Client Component. Heavy third-party scripts hurt INP.- Measure with field data (CrUX/RUM): LCP <= 2.5 s, INP <= 200 ms, CLS <= 0.1 at the 75th percentile.
The red pen
Common traps: mistake → fix
Mistake: "Use
priorityon the hero"Fix: deprecated in Next 16; use
preload, orloading="eager"/fetchPriority="high".Mistake: "Lazy-load every image including the hero"
Fix: delays LCP.
Mistake: "Omit
sizeswithfill"Fix: the browser may pick a far larger image than needed.
Easy to hard
Questions interviewers ask, easy to hard
- Our homepage LCP element is a banner image. How do you use
next/imageandnext/fontto improve LCP and CLS? - What changed in
next/imagedefaults and props in Next 16? - Remote images:
remotePatternsvsdomains? - How does
next/fontprevent layout shift? - Where should a chat widget script load?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.