Skip to content

Commit 73016d0

Browse files
committed
fix: use plain <a> for static file links to avoid RSC 404
Paths with file extensions (e.g. /llms.txt) are static files in public/, not Next.js routes. next/link prefetches them as RSC flight requests (?_rsc=) which 404. Detect file extensions in Link and render a plain <a> tag instead.
1 parent c0c2610 commit 73016d0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

components/Link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default function Link({ children, href, variant = 'block', target, ...res
8080
const resolved = variant;
8181

8282
const hrefString = typeof href === 'string' ? href : href?.toString() || '';
83-
const isExternal = hrefString.startsWith('http') || hrefString.startsWith('//');
83+
const isExternal = hrefString.startsWith('http') || hrefString.startsWith('//') || /\.\w+$/.test(hrefString);
8484
const finalTarget = target || (isExternal ? '_blank' : undefined);
8585
const rel = isExternal ? 'noopener' : undefined;
8686

0 commit comments

Comments
 (0)