From 18cc5f69129615850e48a995f7c3406b74d8d2f4 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sat, 5 Aug 2023 21:11:48 +0100 Subject: Redesign website --- app/middlewares/index.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'app/middlewares/index.ts') diff --git a/app/middlewares/index.ts b/app/middlewares/index.ts index d07726a..81431ca 100644 --- a/app/middlewares/index.ts +++ b/app/middlewares/index.ts @@ -1,18 +1,11 @@ -export const navbar = ((req, res, next) => { - let navbar = ''; - res.locals.directory.primaryPages.forEach(page => { - navbar += ``; - }) - res.locals.navbarHtml = navbar; - next(); -}); +import { PageDirectory } from "../pages.js"; export const page = ((req, res, next) => { - const path = req.params.page ?? 'index'; + const path = req.originalUrl == "/" ? 'index' : req.originalUrl.substring(1); res.locals.path = path; - const page = res.locals.directory.get(path); - + const page = PageDirectory.get(path); + if (!page) { next(); return; -- cgit v1.2.3-70-g09d2