diff --git a/docs/scripts/generate-platform-navigation.js b/docs/scripts/generate-platform-navigation.js index 97c8fa7f8..b823ad078 100644 --- a/docs/scripts/generate-platform-navigation.js +++ b/docs/scripts/generate-platform-navigation.js @@ -64,15 +64,15 @@ export function pageExistsForPlatform(path: string, platform: Platform): boolean // First try to find exact match let page = PLATFORM_PAGES.find(p => p.path === pathWithExt); - + // If not found and path doesn't end with index, try appending /index.mdx if (!page && !pathWithExt.includes('/index.mdx')) { - const indexPath = normalizedPath.endsWith('.mdx') + const indexPath = normalizedPath.endsWith('.mdx') ? normalizedPath.replace('.mdx', '/index.mdx') : \`\${normalizedPath}/index.mdx\`; page = PLATFORM_PAGES.find(p => p.path === indexPath); } - + return page?.platforms.includes(platform) ?? false; }