lbry.tech/app/modules/redirect-404.js

49 lines
1,013 B
JavaScript
Raw Normal View History

2018-10-01 22:47:10 +02:00
"use strict";
2018-11-30 22:02:57 +01:00
// I M P O R T
2018-10-01 22:47:10 +02:00
import html from "choo/html";
2018-10-10 19:56:35 +02:00
// U T I L S
2018-10-01 22:47:10 +02:00
2018-11-30 22:02:57 +01:00
import page404 from "../views/404";
import redirects from "../data/redirects.json";
2018-10-01 22:47:10 +02:00
// E X P O R T
2018-11-30 22:02:57 +01:00
export default state => {
2018-10-01 22:47:10 +02:00
const redirectUrl = redirects[state.href];
if (redirectUrl) {
return html`
<article class="page" itemtype="http://schema.org/BlogPosting">
<header class="page__header">
<div class="page__header-wrap">
<div class="inner-wrap">
<h1 class="page__header__title" itemprop="name headline">404</h1>
</div>
</div>
</header>
<section class="page__content page__markup" itemprop="articleBody">
<div class="inner-wrap">
<p>Redirecting you to <strong>${redirectUrl}</strong></p>
</div>
</section>
</article>
<script>
setTimeout(() => {
window.location.href = "${redirectUrl}";
}, 2000);
</script>
`;
}
2018-11-30 22:02:57 +01:00
return page404();
2018-10-01 22:47:10 +02:00
};