Skip to content
Permalink
Browse files

redirect netlify to /error page

  • Loading branch information...
trojanh committed Apr 1, 2019
1 parent 7ee11ef commit b2616add5474752fee233fb502231290bbfe104e
Showing with 31 additions and 17 deletions.
  1. +1 −16 components/nav.js
  2. +4 −0 netlify.toml
  3. +1 −1 next.config.js
  4. +25 −0 pages/_error.js
@@ -1,13 +1,6 @@
import React from 'react' import React from 'react'
import Link from 'next/link' import Link from 'next/link'


const links = [
{ href: 'https://github.com/segmentio/create-next-app', label: 'Github' }
].map(link => {
link.key = `nav-link-${link.href}-${link.label}`
return link
})

const Nav = () => ( const Nav = () => (
<nav> <nav>
<ul> <ul>
@@ -22,15 +15,6 @@ const Nav = () => (
<a>Quotes list</a> <a>Quotes list</a>
</Link> </Link>
</li> </li>
<ul>
{links.map(({ key, href, label }) => (
<li key={key}>
<Link href={href}>
<a>{label}</a>
</Link>
</li>
))}
</ul>
</ul> </ul>


<style jsx>{` <style jsx>{`
@@ -55,6 +39,7 @@ const Nav = () => (
} }
a { a {
color: #067df7; color: #067df7;
margin: 20px;
text-decoration: none; text-decoration: none;
font-size: 13px; font-size: 13px;
} }
@@ -0,0 +1,4 @@
[[redirects]]
from = "/*"
to = "/error"
status = 404
@@ -14,7 +14,7 @@ module.exports = {
"/": { page: "/" }, "/": { page: "/" },
"/about": { page: "/about" }, "/about": { page: "/about" },
"/quotes-list": { page: "/quotes-list" }, "/quotes-list": { page: "/quotes-list" },
"/_error": { page: "/_error" } "/error": { page: "/_error" }
}, },
); );


@@ -0,0 +1,25 @@
import React from 'react';

const _error = props => {
return (
<div style={{
width: "100%",
color: "RED",
textAlign: 'center',
}}>
<h1 style={{
margin: '0',
width: '100%',
paddingTop: '80px',
lineHeight: '1.15',
fontSize: '48px',
}}>404! </h1>
<p className="description">
Sorry, but the page you were trying to view does not exist.
</p>
</div>
);
};


export default _error;

0 comments on commit b2616ad

Please sign in to comment.
You can’t perform that action at this time.