Skip to content

Commit 4b172d3

Browse files
committed
chore: rename variable and add comment
1 parent ad75be0 commit 4b172d3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

next.dynamic.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,17 @@ const getAllPaths = async () => {
4141
(locale = '') =>
4242
(files = []) =>
4343
sourcePages.map(filename => {
44-
let path = filename.replace(nextConstants.MD_EXTENSION_REGEX, '');
44+
// remove the index.md(x) suffix from a pathname
45+
let pathname = filename.replace(nextConstants.MD_EXTENSION_REGEX, '');
4546
// remove trailing slash for correct Windows pathing of the index files
46-
if (path.length > 1 && path.endsWith(sep)) {
47-
path = path.substring(0, path.length - 1);
47+
if (pathname.length > 1 && pathname.endsWith(sep)) {
48+
pathname = pathname.substring(0, pathname.length - 1);
4849
}
4950
return {
50-
pathname: normalize(path),
51+
pathname: normalize(pathname),
5152
filename: filename,
5253
localised: files.includes(filename),
53-
routeWithLocale: `${locale}/${path}`,
54+
routeWithLocale: `${locale}/${pathname}`,
5455
};
5556
});
5657

0 commit comments

Comments
 (0)