From 14bbf71a2a83d16311250b3995e880ec1499dd82 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sun, 4 Feb 2018 17:03:44 -0700 Subject: [PATCH] don't assume page.title is set in template --- src/helpers/detag.js | 2 +- src/layouts/404.hbs | 2 +- src/layouts/default.hbs | 2 +- src/partials/article.hbs | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helpers/detag.js b/src/helpers/detag.js index 6230d67..ca283a2 100644 --- a/src/helpers/detag.js +++ b/src/helpers/detag.js @@ -1,4 +1,4 @@ 'use strict' const TAG_ALL_RX = /<[^>]+>/g -module.exports = (html) => html.replace(TAG_ALL_RX, '') +module.exports = (html) => html && html.replace(TAG_ALL_RX, '') diff --git a/src/layouts/404.hbs b/src/layouts/404.hbs index 1faa906..56405ac 100644 --- a/src/layouts/404.hbs +++ b/src/layouts/404.hbs @@ -3,7 +3,7 @@ - {{detag page.title}}{{#if site.title}} :: {{site.title}}{{/if}} + {{detag (or page.title 'Page Not Found')}}{{#if site.title}} :: {{site.title}}{{/if}} {{> head}} diff --git a/src/layouts/default.hbs b/src/layouts/default.hbs index 02abf47..850a3b2 100644 --- a/src/layouts/default.hbs +++ b/src/layouts/default.hbs @@ -3,7 +3,7 @@ - {{detag page.title}}{{#if site.title}} :: {{site.title}}{{/if}} + {{detag (or page.title 'Untitled')}}{{#if site.title}} :: {{site.title}}{{/if}} {{#if page.canonicalUrl}} {{/if}} diff --git a/src/partials/article.hbs b/src/partials/article.hbs index cb552ba..a4c23a0 100644 --- a/src/partials/article.hbs +++ b/src/partials/article.hbs @@ -1,4 +1,6 @@
+{{#if page.title}}

{{{page.title}}}

+{{/if}} {{{page.contents}}}
-- 2.11.0