Set up handlebars layout correctly

This commit is contained in:
Robbie Antenesse 2019-09-06 16:24:42 -06:00
parent e4eb9a846c
commit c986cdb4fd
6 changed files with 31 additions and 20 deletions

View File

@ -28,9 +28,8 @@ fastify.register(require('point-of-view'), {
removeEmptyAttributes: true removeEmptyAttributes: true
}, },
partials: { partials: {
head: 'partials/head.hbs', layout: 'layout.hbs',
header: 'partials/header.hbs', header: 'partials/header.hbs',
foot: 'partials/foot.hbs',
footer: 'partials/footer.hbs', footer: 'partials/footer.hbs',
} }
}, },

View File

@ -1,5 +1,6 @@
{{> header }} {{#> layout }}
{{#*inline "page-content-block" }}
<section> <section>
<h2 class="subtitle">An attempt at a viable alternative to Goodreads</h2> <h2 class="subtitle">An attempt at a viable alternative to Goodreads</h2>
@ -24,5 +25,6 @@
{{ text }} {{ text }}
</article> </article>
</section> </section>
{{/inline}}
{{> footer }} {{/layout}}

View File

@ -12,4 +12,29 @@
<link rel="stylesheet" href="/styles/index.css">{{!-- This is controlled by the resources router. --}} <link rel="stylesheet" href="/styles/index.css">{{!-- This is controlled by the resources router. --}}
<script src="index.js"></script> <script src="index.js"></script>
</head> </head>
<body> <body>
{{#> header-block }}
{{> header }}
{{/header-block}}
<main class="container">
{{#> page-content-block }}
{{!-- Wrap the actual page content in {{#*inline "page-content-block"}} to insert it here --}}
{{/page-content-block}}
</main>
{{#> footer-block }}
{{> footer }}
{{/footer-block}}
{{#> scripts-block }}
<script>
(function () {
alert('test');
})();
</script>
{{/scripts-block}}
</body>
</html>

View File

@ -1,7 +0,0 @@
<script>
(function() {
alert('test');
})();
</script>
</body>
</html>

View File

@ -1,7 +1,3 @@
</main>
<footer> <footer>
<p>test footer</p> <p>test footer</p>
</footer> </footer>
{{> foot }}

View File

@ -1,5 +1,3 @@
{{> head }}
<header> <header>
<nav> <nav>
<div class="brand"> <div class="brand">
@ -21,5 +19,3 @@
</div> </div>
</nav> </nav>
</header> </header>
<main class="container">