chore: fix website URLs (#9490)

GitHub Pages appends trailing slashes which might break docusaurus
links.
This commit is contained in:
Alex Rudenko 2023-01-11 15:51:39 +01:00 committed by GitHub
parent 5da15170e4
commit 29b948197d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -41,6 +41,13 @@ const config = {
defaultLocale: 'en', defaultLocale: 'en',
locales: ['en'], locales: ['en'],
}, },
scripts: [
{
src: '/fix-location.js',
async: false,
defer: false,
},
],
webpack: { webpack: {
jsLoader: isServer => { jsLoader: isServer => {
return { return {

View File

@ -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());
}