aboutsummaryrefslogtreecommitdiffstats
path: root/app/routes/page
diff options
context:
space:
mode:
Diffstat (limited to 'app/routes/page')
-rw-r--r--app/routes/page/router.ts19
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)
});
});