mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: fix website URLs (#9490)
GitHub Pages appends trailing slashes which might break docusaurus links.
This commit is contained in:
parent
5da15170e4
commit
29b948197d
@ -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 {
|
||||||
|
5
website/static/fix-location.js
Normal file
5
website/static/fix-location.js
Normal 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());
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user