@@ -128,25 +128,24 @@ export function isMetadataRouteFile(
128
128
)
129
129
}
130
130
131
- function isStaticMetadataRoutePage ( appDirRelativePath : string ) {
131
+ export function isStaticMetadataRoutePage ( appDirRelativePath : string ) {
132
132
return isMetadataRouteFile ( appDirRelativePath , [ ] , true )
133
133
}
134
134
135
135
// Check if the route is a static metadata route, with /route suffix
136
- // e.g. /robots.txt/route, /sitemap.xml/route, /favicon.ico/route, /manifest/route, /icon/route, etc.
136
+ // e.g. /favicon.ico/route, /icon.png/route, etc.
137
+ // But skip the text routes like robots.txt since they might also be dynamic.
138
+ // Checking route path is not enough to determine if text routes is dynamic.
137
139
export function isStaticMetadataRoute ( route : string ) {
138
140
const pathname = route . slice ( 0 , - '/route' . length )
139
- return isAppRouteRoute ( route ) && isStaticMetadataRoutePage ( pathname )
140
- }
141
-
142
- // Check if the page is a static metadata route file
143
- // e.g. /robots, /manifest, /favicon.ico, /sitemap.xml, /icon.png, etc.
144
- export function isStaticMetadataRoutePathname ( page : string ) {
145
141
return (
146
- // TODO: avoid directly checking pathnames as they can also be page routes
147
- page === '/robots' ||
148
- page === '/manifest' ||
149
- isStaticMetadataRoutePage ( page )
142
+ isAppRouteRoute ( route ) &&
143
+ isStaticMetadataRoutePage ( pathname ) &&
144
+ // These routes can either be built by static or dynamic entrypoints,
145
+ // so we assume they're dynamic
146
+ pathname !== '/robots.txt' &&
147
+ pathname !== '/manifest.webmanifest' &&
148
+ ! pathname . endsWith ( '/sitemap.xml' )
150
149
)
151
150
}
152
151
0 commit comments