diff --git a/packages/docusaurus/src/client/normalizeLocation.ts b/packages/docusaurus/src/client/normalizeLocation.ts index 41a19b5816e6..0a609524555d 100644 --- a/packages/docusaurus/src/client/normalizeLocation.ts +++ b/packages/docusaurus/src/client/normalizeLocation.ts @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import routes from '@generated/routes'; +import {matchRoutes} from 'react-router-config'; import type {Location} from 'history'; // Memoize previously normalized pathnames. @@ -18,6 +20,11 @@ export default function normalizeLocation(location: T): T { }; } + if (matchRoutes(routes, location.pathname)) { + pathnames[location.pathname] = location.pathname; + return location; + } + const pathname = location.pathname.trim().replace(/(?:\/index)?\.html$/, '') || '/'; diff --git a/website/_dogfooding/_docs tests/dummy.md b/website/_dogfooding/_docs tests/dummy.md index ea913c996231..8ec7fc90fbdb 100644 --- a/website/_dogfooding/_docs tests/dummy.md +++ b/website/_dogfooding/_docs tests/dummy.md @@ -1 +1,5 @@ +--- +slug: dummy.html +--- + # Just a dummy page