Capítulo 373 de 456
The public folder at the project root serves static files directly from the base URL (/), e.g. images, robots.txt, favicon.ico.
public/: files referenced starting from /; public/avatars/me.png is served at /avatars/me.png.Cache-Control: public, max-age=0 by default since it can't safely assume these assets are immutable.public/ sharing a name with a file in pages/ causes a build error.import Image from 'next/image'
export function Avatar({ id, alt }) {
return <Image src={`/avatars/${id}.png`} alt={alt} width="64" height="64" />
}
public/ asset via absolute path.None.
public/ file the same as a pages/ route: throws a build error (conflicting public file/page).max-age=0; configure headers() in next.config.js per-asset if you need longer caching.public/ for robots.txt, favicon.ico, verification files, and any static asset needing a stable public URL.next.config.js headers if needed.public/ and pages/.public/ must always stay at the project root even when using src/.public/.