crappy redirects, 404 tweak, markdown img
This commit is contained in:
parent
26487ff4bd
commit
aa912035a7
5 changed files with 51 additions and 17 deletions
5
app/data/redirects.json
Normal file
5
app/data/redirects.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"/tour" : "/playground",
|
||||||
|
"/play" : "/playground",
|
||||||
|
"/whitepaper": "https://whitepaper.lbry.tech"
|
||||||
|
}
|
4
app/modules/redirect.js
Normal file
4
app/modules/redirect.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export default (url, code = 301) => {
|
||||||
|
console.log(code + ": " + url);
|
||||||
|
throw "fix this please, needs to redirect to:" + url;
|
||||||
|
}
|
|
@ -162,6 +162,13 @@
|
||||||
padding-left: 1.25rem;
|
padding-left: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
img {
|
img {
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
import html from "choo/html";
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
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>The requested page could not be found. Here is the image located at <a href="https://lbry.tech/playground">lbry://404</a> to console you.</p>
|
||||||
|
<img src="https://spee.ch/404.png" title="lbry://404" />
|
||||||
|
<p>Think something should be here? Let us know by <a href="/contribute#raising-issues">raising an issue</a>.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
|
@ -11,6 +11,9 @@ import fs from "graceful-fs";
|
||||||
import html from "choo/html";
|
import html from "choo/html";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { require as local } from "app-root-path";
|
import { require as local } from "app-root-path";
|
||||||
|
import redirects from '../data/redirects.json';
|
||||||
|
import redirect from "../modules/redirect";
|
||||||
|
import Page404 from "./404.js";
|
||||||
import raw from "choo/html/raw";
|
import raw from "choo/html/raw";
|
||||||
|
|
||||||
// V A R I A B L E S
|
// V A R I A B L E S
|
||||||
|
@ -46,23 +49,12 @@ module.exports = exports = (state, emit) => { // eslint-disable-line
|
||||||
else path = state.params.wildcard;
|
else path = state.params.wildcard;
|
||||||
|
|
||||||
if (!fs.existsSync(`./documents/${path}.md`)) {
|
if (!fs.existsSync(`./documents/${path}.md`)) {
|
||||||
return html`
|
const redirectUrl = redirects[path] || redirects["/" + path]
|
||||||
<article class="page" itemtype="http://schema.org/BlogPosting">
|
if (redirectUrl) {
|
||||||
<header class="page__header">
|
redirect(redirectUrl)
|
||||||
<div class="page__header-wrap">
|
} else {
|
||||||
<div class="inner-wrap">
|
return Page404();
|
||||||
<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>The page you are looking for does not exist.</p>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</article>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const markdownFile = fs.readFileSync(`./documents/${path}.md`, "utf-8");
|
const markdownFile = fs.readFileSync(`./documents/${path}.md`, "utf-8");
|
||||||
|
|
Loading…
Reference in a new issue