diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-12-22 20:35:16 +0000 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-12-22 20:35:16 +0000 |
| commit | 951984fb55d552d9c816a30069e2321f3602d305 (patch) | |
| tree | 3763441916dffff9ca96dd0286c72104ba2954c0 /app/routes/page/router.ts | |
| parent | 4ddf6fc9ed90a704869da683561e5032b6c48d79 (diff) | |
Add circular dependency detection and logging library
Diffstat (limited to 'app/routes/page/router.ts')
| -rw-r--r-- | app/routes/page/router.ts | 19 |
1 files changed, 17 insertions, 2 deletions
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 = '<div class="box-red">This page could not be built due to the following errors:<br><ul>' + page.metadata.errors.forEach(e => { + html += `<li>${e.identifier}: ${e.message}</li>` + }); + html += '</ul>Go <a href="/">home</a>?</div>' + 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) }); }); |
