forked from pytorch/pytorch.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
83 lines (71 loc) · 2.31 KB
/
404.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
title: Oops!
id: 404
permalink: /404.html
layout: general
---
<script type="text/javascript" charset="utf-8">
const FALLBACK_URL = '';
const REDIRECT_STYLE = {
// Redirect completely, appending the path to the newly specified location.
// This is useful for project renames or moving to a different org.
FULL: 0,
// Redirect to the specific location, losing path information
// This is useful when you just want to capture the audience to known working page.
SIMPLE: 1,
// Redirect to the project's 404 page, injecting the original URL.
FOUROHFOUR_DEFAULT: 2,
// Redirect to the specified path, replacing ${from} with the original URL.
FOUROHFOUR_CUSTOM: 3,
};
const PROJECTS = {
live: {
location: 'https://playtorch.dev/',
style: REDIRECT_STYLE.FULL,
},
};
// eg "https://facebook.github.io/flux/docs/overview/"
const ORIGINAL_URL = window.location.href;
// eg [ "", "flux", "docs", "overview", "" ]
const PATH_PARTS = window.location.pathname.split('/');
// eg "flux"
const PROJECT = PATH_PARTS[1];
// eg "docs/overview/"
const SUBPATH = PATH_PARTS.slice(2).join('/');
// Perform the redirect only for explicitly defined projects.
// Otherwise show the 404 page below
if (PROJECTS.hasOwnProperty(PROJECT)) {
let newUrl = '';
let project = PROJECTS[PROJECT];
switch (project.style) {
case REDIRECT_STYLE.FULL:
newUrl = project.location + SUBPATH;
break;
case REDIRECT_STYLE.SIMPLE:
newUrl = project.location;
break;
case REDIRECT_STYLE.FOUROHFOUR_DEFAULT:
newUrl = project.location + '404.html?from=' + ORIGINAL_URL;
break;
case REDIRECT_STYLE.FOUROHFOUR_CUSTOM:
newUrl = project.location.replace('${from}', ORIGINAL_URL);
break;
default:
newUrl = FALLBACK_URL;
}
if (newUrl !== '') {
window.location.href = newUrl;
}
}
</script>
<div style="text-align: center;">
<img src="{{ site.baseurl }}/assets/images/404_sign.png" />
<h1>Oops!</h1>
<h4>You've reached a dead end.</h4>
<h4>
If you feel like something should be here, you can <a href="https://github.com/pytorch/pytorch.github.io/issues">open an issue</a> on GitHub.
</h4>
<h4>
Click <a href="/">here</a> to go back to the main page.
</h4>
</div>