Skip to content
Snippets Groups Projects
Commit 4b1ed08e authored by Martyn Welch's avatar Martyn Welch
Browse files

Add dynamic redirection 404 page


We want to redirect linking that pages without a version specified to
the latest to ensure existing linking continues to work. For everything
else, lets redirect to the main page.

Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
parent 6e128643
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ pages:
stage: deploy
script:
- mkdir public
- cp static/* public/
- ./atc test-cases/ -d public/latest/ --index-page
artifacts:
paths:
......
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Redirecting</title>
</head>
<body onload="redirect()">
<h1 style="text-align: center; padding-top: 50px; display: block;">Redirecting...</h1>
<script>
function redirect() {
setTimeout(munge_url, 100);
}
function munge_url() {
var url = window.location.pathname;
var url_parts = url.split("/");
var num = url_parts.length;
new_url = new URL(window.location);
if ((num == 2) && (url_parts[num - 1].endsWith(".html"))) {
new_url.pathname = ["latest", url_parts[num - 1]].join('/')
} else {
new_url.pathname = "";
}
window.location.replace(new_url);
}
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment