Skip to content

Commit b83789b

Browse files
committed
[site] Fix custom redirects for issue tracker #522
1 parent 8f94e04 commit b83789b

File tree

5 files changed

+40
-33
lines changed

5 files changed

+40
-33
lines changed

website/mkdocs.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,3 @@ markdown_extensions: [fenced_code]
3939

4040
extra_css:
4141
- style.css
42-
43-
extra_javascript:
44-
- redirect.js

website/overrides/404.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{% extends "base.html" %}
2+
3+
{% block title %}Page Not Found{% endblock %}
4+
5+
{% block content %}
6+
<h1 id="404-title">Page Not Found</h1>
7+
<p id="404-body">This page does not exist.</p>
8+
9+
<script>
10+
(function() {
11+
var path = window.location.pathname;
12+
var pageTitle = document.getElementById('404-title');
13+
var pageBody = document.getElementById('404-body');
14+
15+
const TARGETS = [ '/issue', '/issues', '/issue/', '/issues/' ];
16+
for (const target of TARGETS) {
17+
if (path === target) {
18+
pageTitle.innerText = 'Redirecting...';
19+
pageBody.innerText = 'Redirecting to GitHub issues...';
20+
window.location.href = 'https://github.com/Breakthrough/PySceneDetect/issues/';
21+
return;
22+
}
23+
}
24+
25+
const PREFIXES = ['/issue/', '/issues/'];
26+
for (const prefix of PREFIXES) {
27+
if (path.startsWith(prefix)) {
28+
var issueNumber = path.substring(prefix.length);
29+
if (issueNumber) {
30+
pageTitle.innerText = 'Redirecting...';
31+
pageBody.innerText = 'Redirecting to issue #' + issueNumber + ' on GitHub...';
32+
var newUrl = 'https://github.com/Breakthrough/PySceneDetect/issues/' + issueNumber;
33+
window.location.href = newUrl;
34+
return;
35+
}
36+
}
37+
}
38+
})();
39+
</script>
40+
{% endblock %}

website/pages/issue.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

website/pages/issues.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

website/pages/redirect.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)