Browse Source

Add launcher redirects

pull/256/head
Tomas Slusny 4 months ago
parent
commit
e636c2877a
3 changed files with 43 additions and 0 deletions
  1. 17
    0
      config-overrides.js
  2. 18
    0
      redirect.html
  3. 8
    0
      redirect.js

+ 17
- 0
config-overrides.js View File

@@ -16,6 +16,7 @@ const fm = require('front-matter')
const libxmljs = require('libxmljs')
const hero = require('./src/_data/hero')
const parseBlog = require('./src/parse-blog')
const redirectConfig = require('./redirect')

// Escape html
const escapeHtml = unsafe => {
@@ -126,6 +127,22 @@ const addSitePlugins = () => config => {
})
)

for (let key in redirectConfig.links) {
const link = redirectConfig.links[key]

config.plugins.push(
new HtmlWebpackPlugin({
redirect: {
url: link
},
template: 'redirect.html',
filename: redirectConfig.prefix + '/' + key + '/index.html',
inject: false,
xhtml: false
})
)
}

return config
}


+ 18
- 0
redirect.html View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="refresh"
content="0; url=<%= htmlWebpackPlugin.options.redirect.url %>"
/>
<script type="text/javascript">
window.location.href = '<%= htmlWebpackPlugin.options.redirect.url %>'
</script>
<title>Redirecting...</title>
</head>
<body>
If you are not redirected automatically, follow this
<a href="<%= htmlWebpackPlugin.options.redirect.url %>">link</a>.
</body>
</html>

+ 8
- 0
redirect.js View File

@@ -0,0 +1,8 @@
module.exports = {
prefix: 'redirect',
links: {
'launcher/discord': 'https://discord.gg/ArdAhnN',
'launcher/troubleshooting':
'https://github.com/runelite/runelite/wiki/Troubleshooting-problems-with-the-client'
}
}

Loading…
Cancel
Save