From c986cdb4fdd1ad9863b4993802a4104cc835311a Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Fri, 6 Sep 2019 16:24:42 -0600 Subject: [PATCH] Set up handlebars layout correctly --- server.js | 3 +-- views/home.hbs | 6 ++++-- views/{partials/head.hbs => layout.hbs} | 27 ++++++++++++++++++++++++- views/partials/foot.hbs | 7 ------- views/partials/footer.hbs | 4 ---- views/partials/header.hbs | 4 ---- 6 files changed, 31 insertions(+), 20 deletions(-) rename views/{partials/head.hbs => layout.hbs} (56%) delete mode 100644 views/partials/foot.hbs diff --git a/server.js b/server.js index f8f4e6c..e5878b8 100644 --- a/server.js +++ b/server.js @@ -28,9 +28,8 @@ fastify.register(require('point-of-view'), { removeEmptyAttributes: true }, partials: { - head: 'partials/head.hbs', + layout: 'layout.hbs', header: 'partials/header.hbs', - foot: 'partials/foot.hbs', footer: 'partials/footer.hbs', } }, diff --git a/views/home.hbs b/views/home.hbs index 3533f31..9ee4f19 100644 --- a/views/home.hbs +++ b/views/home.hbs @@ -1,5 +1,6 @@ -{{> header }} +{{#> layout }} +{{#*inline "page-content-block" }}

An attempt at a viable alternative to Goodreads

@@ -24,5 +25,6 @@ {{ text }}
+{{/inline}} -{{> footer }} \ No newline at end of file +{{/layout}} \ No newline at end of file diff --git a/views/partials/head.hbs b/views/layout.hbs similarity index 56% rename from views/partials/head.hbs rename to views/layout.hbs index ecfc21f..9fd667f 100644 --- a/views/partials/head.hbs +++ b/views/layout.hbs @@ -12,4 +12,29 @@ {{!-- This is controlled by the resources router. --}} - \ No newline at end of file + + +{{#> header-block }} + {{> header }} +{{/header-block}} + +
+{{#> page-content-block }} + {{!-- Wrap the actual page content in {{#*inline "page-content-block"}} to insert it here --}} +{{/page-content-block}} +
+ +{{#> footer-block }} + {{> footer }} +{{/footer-block}} + +{{#> scripts-block }} + +{{/scripts-block}} + + + \ No newline at end of file diff --git a/views/partials/foot.hbs b/views/partials/foot.hbs deleted file mode 100644 index 60ec811..0000000 --- a/views/partials/foot.hbs +++ /dev/null @@ -1,7 +0,0 @@ - - - \ No newline at end of file diff --git a/views/partials/footer.hbs b/views/partials/footer.hbs index 3c5c312..27ef13b 100644 --- a/views/partials/footer.hbs +++ b/views/partials/footer.hbs @@ -1,7 +1,3 @@ - - - -{{> foot }} \ No newline at end of file diff --git a/views/partials/header.hbs b/views/partials/header.hbs index d021ef1..356184c 100644 --- a/views/partials/header.hbs +++ b/views/partials/header.hbs @@ -1,5 +1,3 @@ -{{> head }} -
- -
\ No newline at end of file