puppeteer/website/static/fix-location.js
Alex Rudenko 29b948197d
chore: fix website URLs (#9490)
GitHub Pages appends trailing slashes which might break docusaurus
links.
2023-01-11 15:51:39 +01:00

6 lines
236 B
JavaScript

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