-
Notifications
You must be signed in to change notification settings - Fork 3
/
404.html
65 lines (57 loc) · 2.26 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
---
title: "Page not found"
layout: primary
permalink: /404.html
lead: "404 Error"
---
<script>
var all_policies = [];
function redirectToCorrectPage() {
{% for policy in site.policies %}
all_policies.push("{{ site.baseurl }}{{ policy.url }}");
{% endfor %}
console.log(all_policies);
var url = window.location.toString();
if (url.slice(-1) === "/") {
url = url.slice(0, -1);
}
console.log(url);
if (url.includes('/doc/')) {
window.location = url.replace('/doc/', '/collection/')
}
// temporary, due to a specific situation
var urls_to_handle = {
'http://www.opendatapolicies.org/Austin,TX(2013)': 'http://www.opendatapolicies.org/doc/austin-tx-2013-08-26/',
'http://www.opendatapolicies.org/Cincinnati,OH(20/?q=cincinnati': 'http://www.opendatapolicies.org/doc/cincinnati-oh-2014-05-29/',
'http://www.opendatapolicies.org/Denton,%20TX%20(2015/?q=denton': 'http://www.opendatapolicies.org/doc/denton-tx-2015-02-09/'
}
if (url in urls_to_handle) {
console.log('before page redirect');
window.location = urls_to_handle[url];
console.log('after page redirect');
}
var year_re = /http.+\d{4}$/;
if (year_re.test(url)) {
matching_urls = [];
for (var i = 0; i < all_policies.length; i++) {
if (all_policies[i].includes(url)) {
matching_urls.push(all_policies[i]);
}
}
console.log(matching_urls);
if (matching_urls.length === 1) {
window.location = matching_urls[0];
} else if (matching_urls.length > 1) {
// replace this with the state page
window.location = 'http://www.opendatapolicies.org/browse/'
} else {
window.location = 'http://www.opendatapolicies.org/browse/';
}
}
}
window.onload = redirectToCorrectPage;
</script>
<p>Sorry, we can’t find what you’re looking for! Check out our <a href="{{ site.baseurl }}">home page</a> to explore the site’s offerings.</p>
<!-- <p>If you were directed here from our old OpenDataPolicies.org site, check out our <a href="{{ site.baseurl }}/collection">Open Data Policy Collection</a>. -->
<p>Feel free to contact us at <a href="mailto:[email protected]">[email protected]</a> if you believe you are getting this page in error or were directed here through a broken link.</p>
<p></p>