fix canonical redirect
This commit is contained in:
parent
5680b19dc8
commit
e40aa84a40
1 changed files with 6 additions and 1 deletions
|
@ -84,7 +84,12 @@ function ShowPage(props: Props) {
|
||||||
// Only redirect if we are in lbry.tv land
|
// Only redirect if we are in lbry.tv land
|
||||||
// replaceState will fail if on a different domain (like webcache.googleusercontent.com)
|
// replaceState will fail if on a different domain (like webcache.googleusercontent.com)
|
||||||
if (canonicalUrlPath !== window.location.pathname && DOMAIN === window.location.hostname) {
|
if (canonicalUrlPath !== window.location.pathname && DOMAIN === window.location.hostname) {
|
||||||
history.replaceState(history.state, '', canonicalUrlPath);
|
const urlParams = new URLSearchParams(search);
|
||||||
|
if (urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID)) {
|
||||||
|
const listId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || '';
|
||||||
|
urlParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||||
|
}
|
||||||
|
history.replaceState(history.state, '', `${canonicalUrlPath}?${urlParams.toString()}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @endif
|
// @endif
|
||||||
|
|
Loading…
Reference in a new issue