From 49a9fe2f914f1e8fbc87940c8f099fb70b27ecb7 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Thu, 21 Apr 2022 17:36:05 +0800 Subject: [PATCH] dogfood? --- packages/docusaurus/src/client/normalizeLocation.ts | 7 +++++++ website/_dogfooding/_docs tests/dummy.md | 4 ++++ 2 files changed, 11 insertions(+) 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