From 951984fb55d552d9c816a30069e2321f3602d305 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Wed, 22 Dec 2021 20:35:16 +0000 Subject: Add circular dependency detection and logging library --- app/routes/page/router.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'app/routes/page/router.ts') diff --git a/app/routes/page/router.ts b/app/routes/page/router.ts index af5e844..dc819f8 100644 --- a/app/routes/page/router.ts +++ b/app/routes/page/router.ts @@ -26,11 +26,26 @@ router.get('/:page?', navbar, (req, res, next) => { return; } + let html: string; + let title: string; + + if (page.metadata.errors.length != 0) { + html = '
This page could not be built due to the following errors:
Go home?
' + title = 'Page error' + } else { + html = page.html; + title = page.metadata.displayTitle; + } + res.render('page.ejs', { navbar: res.locals.navbarHtml, path: res.locals.path, - content: page.html, - title: page.metadata.displayTitle, + content: html, + title: title, buildTime: new Date(page.buildTime) }); }); -- cgit v1.2.3-70-g09d2