-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathredirect.html
47 lines (45 loc) · 1.33 KB
/
redirect.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
---js
{
pagination: {
data: "collections.all",
size: 1,
alias: "redirect",
before: function (data) {
const all = data.reduce((redirects, page) => {
if (Array.isArray(page.data.redirect_from)) {
for (let url of page.data.redirect_from) {
redirects.push({ to: page.url, from: url });
}
} else if (typeof page.data.redirect_from === 'string') {
redirects.push({ to: page.url, from: page.data.redirect_from });
}
if (page.data.redirect_from) {
}
return (redirects);
}, []);
return all.filter(({ to, from })=> to !== from);
},
addAllPagesToCollections: false,
},
permalink: "{{ redirect.from }}/index.html",
eleventyExcludeFromCollections: true,
}
---
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>Redirecting…</title>
<link rel="canonical" href="{{ redirect.to | url }}" />
<script>
location = "{{ redirect.to | url }}"
</script>
<meta name="rel-path" content="{{ redirect.to | url }}" />
<meta http-equiv="refresh" content="0; url={{ redirect.to | url }}" />
<meta name="robots" content="noindex" />
</head>
<body>
<h1>Redirecting…</h1>
<a href="{{ redirect.to | url }}">Click here if you are not redirected.</a>
</body>
</html>