Skip to content

Commit

Permalink
Merge pull request #13 from beforesemicolon/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ECorreia45 authored Jul 6, 2021
2 parents f308ade + 65693a2 commit d6f8e97
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
13 changes: 10 additions & 3 deletions core/engine/page-and-resources-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,19 @@ function pageAndResourcesMiddleware(pagesRoutes, pagesDirectoryPath, {env, onPag
return res.sendStatus(404);
}
} else if(!ext || ext === '.html') {
const template = pagesRoutes[req.path] ?? pagesRoutes[`${req.path}/`] ?? pagesRoutes['/404'];
const template = pagesRoutes[req.path] ?? pagesRoutes[`${req.path}/`];

if (template) {
return res.render(template, onPageRequest(req) ?? {})
return res.render(template, onPageRequest(req) || {})
} else if(!ext || ext === '.html') {
return res.send('<h1>404 - Page Not Found</h1>')

if (req.path.startsWith('/404')) {
return pagesRoutes['/404']
? res.render(pagesRoutes['/404'])
: res.send('<h1>404 - Page Not Found</h1>')
}

return res.redirect('/404')
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@beforesemicolon/html-plus",
"version": "0.4.1",
"version": "0.4.2",
"description": "HTML Template Engine/Language",
"main": "dist/index.js",
"files": [
Expand Down
4 changes: 3 additions & 1 deletion website/pages/404.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

.not-found {
text-align: center;
padding: 50px 30%;
padding-top: 50px;
padding-bottom: 50px;
@include wrapper(350px);

h2 {
font-size: 3rem;
Expand Down
5 changes: 3 additions & 2 deletions website/pages/learn/learn.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@import "../_sass/common";
@import "../_partials/layout";


.learn {
text-align: center;
padding: 50px 30%;
padding-top: 50px;
padding-bottom: 50px;
@include wrapper(350px);

h2 {
font-size: 3rem;
Expand Down

0 comments on commit d6f8e97

Please sign in to comment.