diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index cb9a4293..a3825dd6 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -41,6 +41,13 @@ const config = { defaultLocale: 'en', locales: ['en'], }, + scripts: [ + { + src: '/fix-location.js', + async: false, + defer: false, + }, + ], webpack: { jsLoader: isServer => { return { diff --git a/website/static/fix-location.js b/website/static/fix-location.js new file mode 100644 index 00000000..710716d7 --- /dev/null +++ b/website/static/fix-location.js @@ -0,0 +1,5 @@ +const url = new URL(window.location.href); +if (url.pathname.endsWith('/') && url.pathname !== '/') { + url.pathname = url.pathname.substring(0, url.pathname.length - 1); + window.history.replaceState(null, undefined, url.toString()); +}