Skip to content

Commit

Permalink
Merge pull request #113 from marzepani/404-page
Browse files Browse the repository at this point in the history
Fix for #16: Add a 404 page
  • Loading branch information
Frijol authored May 31, 2017
2 parents f231066 + d26e76a commit 00825fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ bower_components
node_modules
build
deploy/**/*.retry
.env
.vscode/settings.json
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ app.use(function (req, res, next) {
next();
});

app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'build/public')));
app.use(express.favicon('public/favicon.ico'));
app.use(app.router);

app.locals.encoder = new require('node-html-encoder').Encoder('entity');

Expand Down Expand Up @@ -427,6 +427,14 @@ app.get('/blog/:postid/:slug?', function (req, res) {
});
});

// 404 route
app.get('*', function(req, res){
res.render('error', {
navbar: indexdata.navbar,
title: 'Page not found | Tessel'
});
});

app.locals.ucfirst = function(value) {
return value.charAt(0).toUpperCase() + value.slice(1);
};
Expand Down
5 changes: 4 additions & 1 deletion views/error.jade
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ block content
h2 Something went wrong with that request :(
.row(style="margin-bottom:20px;")
.large-12.small-centered.columns(style="text-align:center")
h4 Sorry about that. Need help? Email [email protected].
h4
| Sorry about that. Need help? Email
a(href='mailto:[email protected]') [email protected]
| .

.row
.large-12.large-center.columns(style="text-align:center;height:550px")
Expand Down

0 comments on commit 00825fc

Please sign in to comment.