From 0986ee8ea622d6812a0cba12e1bcd07373cf7a32 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Wed, 8 Apr 2020 01:22:13 -0600 Subject: [PATCH] use #with for simple template fragments guarded by truthy checks --- src/partials/article.hbs | 6 +++--- src/partials/head-info.hbs | 18 +++++++++--------- src/partials/head-scripts.hbs | 8 ++++---- src/partials/head-title.hbs | 2 +- src/partials/toolbar.hbs | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/partials/article.hbs b/src/partials/article.hbs index 11a5117..edd5a08 100644 --- a/src/partials/article.hbs +++ b/src/partials/article.hbs @@ -9,9 +9,9 @@ If you typed the URL of this page manually, please double check that you entered the address correctly.

{{else}} -{{#if page.title}} -

{{{page.title}}}

-{{/if}} +{{#with page.title}} +

{{{this}}}

+{{/with}} {{{page.contents}}} {{/if}} diff --git a/src/partials/head-info.hbs b/src/partials/head-info.hbs index 71012a1..bf1f19b 100644 --- a/src/partials/head-info.hbs +++ b/src/partials/head-info.hbs @@ -1,13 +1,13 @@ - {{#if page.canonicalUrl}} - - {{/if}} + {{#with page.canonicalUrl}} + + {{/with}} {{#if page.component}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} + {{#with page.description}} + + {{/with}} + {{#with page.keywords}} + + {{/with}} {{/if}} {{#with (or antoraVersion site.antoraVersion)}} diff --git a/src/partials/head-scripts.hbs b/src/partials/head-scripts.hbs index 41ad69e..e7da2bb 100644 --- a/src/partials/head-scripts.hbs +++ b/src/partials/head-scripts.hbs @@ -1,4 +1,4 @@ - {{#if site.keys.googleAnalytics}} - - - {{/if}} + {{#with site.keys.googleAnalytics}} + + + {{/with}} diff --git a/src/partials/head-title.hbs b/src/partials/head-title.hbs index c96c8f2..924fcac 100644 --- a/src/partials/head-title.hbs +++ b/src/partials/head-title.hbs @@ -1 +1 @@ - {{{detag (or page.title defaultPageTitle)}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{{detag (or page.title defaultPageTitle)}}}{{#with site.title}} :: {{this}}{{/with}} diff --git a/src/partials/toolbar.hbs b/src/partials/toolbar.hbs index 4e6f59b..dd4e3d7 100644 --- a/src/partials/toolbar.hbs +++ b/src/partials/toolbar.hbs @@ -1,8 +1,8 @@