feat: add redirects for old Polytoria site paths
This commit is contained in:
parent
3206c6bbcd
commit
85b4683a66
2 changed files with 42 additions and 0 deletions
37
js/site-redirects.js
Normal file
37
js/site-redirects.js
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
const URLs = [
|
||||||
|
{
|
||||||
|
Old: "/games/",
|
||||||
|
New: "/places/"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
Old: "/shop/",
|
||||||
|
New: "/store/"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
Old: "/my/referrals",
|
||||||
|
New: "/my/settings/referrals"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
Old: "/create/?t=",
|
||||||
|
New: "/create/"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
Old: "/user/",
|
||||||
|
New: "/users/"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
Old: "/library/",
|
||||||
|
New: "/models/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
let Matches = URLs.filter((x) => window.location.pathname.startsWith(x.Old))
|
||||||
|
if (Matches.length > 0) {
|
||||||
|
let Match = Matches[0]
|
||||||
|
window.location.pathname = window.location.pathname.replace(Match.Old, Match.New)
|
||||||
|
}
|
||||||
|
|
@ -118,6 +118,11 @@
|
||||||
"js": ["/js/library-download.js"]
|
"js": ["/js/library-download.js"]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"matches": ["https://polytoria.com/games/*", "https://polytoria.com/shop/*", "https://polytoria.com/my/referrals", "https://polytoria.com/create/?t=*", "https://polytoria.com/user/*", "https://polytoria.com/library/*"],
|
||||||
|
"js": ["/js/site-redirects.js"]
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"matches": ["https://polytoria.com/places/**", "https://polytoria.com/u/**"],
|
"matches": ["https://polytoria.com/places/**", "https://polytoria.com/u/**"],
|
||||||
"js": ["the-great-divide.js"]
|
"js": ["the-great-divide.js"]
|
||||||
|
|
|
||||||
Reference in a new issue