File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,14 @@ function findNonComponentMarkdownFiles(
264264 pathname . startsWith ( '/material-ui/' ) &&
265265 ! ignoredPaths . some ( ( ignored ) => pathname . startsWith ( ignored ) )
266266 ) {
267- const page = allMarkdownFiles . find ( ( p ) => p . pathname === parsedPathname ) ;
267+ // Match by filename basename to avoid pathname collisions when multiple files
268+ // exist in the same directory (e.g., upgrade-to-v7.md and upgrade-to-native-color.md)
269+ const lastSegment = pathname . split ( '/' ) . filter ( Boolean ) . pop ( ) ;
270+ const page = allMarkdownFiles . find ( ( p ) => {
271+ const fileBasename = path . basename ( p . filename ) . replace ( / \. m d x ? $ / , '' ) ;
272+ // p.pathname already has the parent path (from findPagesMarkdown which strips the filename)
273+ return fileBasename === lastSegment && p . pathname === parsedPathname ;
274+ } ) ;
268275
269276 if ( page ) {
270277 files . push ( {
You can’t perform that action at this time.
0 commit comments