-
Notifications
You must be signed in to change notification settings - Fork 0
/
redirect_from.njk
35 lines (35 loc) · 1.06 KB
/
redirect_from.njk
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
---js
{
pagination: {
data: 'collections.all',
size: 1,
alias: 'redirect',
before: function (data) {
return 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 });
}
return redirects;
}, []);
},
addAllPagesToCollections: false,
},
permalink: '{{ redirect.from }}/index.html',
eleventyExcludeFromCollections: true,
}
---
<!DOCTYPE html>
<html lang='en-US'>
<meta charset='utf-8' />
<title>Redirect to {{ redirect.to }}</title>
<link rel='canonical' href='{{ redirect.to | url }}' />
<script>location = '{{ redirect.to | url }}';</script>
<meta http-equiv='refresh' content='0; url={{ redirect.to | url }}' />
<meta name='robots' content='noindex' />
<h1>Redirecting to {{ redirect.to }}</h1>
<p><a href='{{ redirect.to | url }}'>Click here if you are not redirected.</a></p>
</html>