Search
Learn
Share

How to create a dynamic site with HTML and CSS only (almost)

Published by Profile Image Jon Erik Solheim on 31 July, 2016
181 views
Data from the database is injected into the Handlebars context. A really easy way to create dynamic sites.
<!-- load data labels from the settings collection -->
{{#context}}
{
"settings":{
"collection": "settings",
"query":{},
"as":{
"type":"map",
"key":"name"
}
}
}
{{/context}}

<!-- use the master page "layout" for this page -->
{{#inherit "layout"}}
{{#block "title"}}
<!-- get title text from settings collection -->
<h1>{{settings.[about-title].textvalue}}</h1>
{{/block}}

{{#block "content"}}
<!-- get body html from settings collection -->
{{{settings.[about-body].htmlvalue}}}
{{/block}}

<!-- reuse a partial page here -->
{{#block "sidebar"}}
{{#include "contact-partial"}}{{/include}}
{{/block}}

{{/inherit}}

Read blog post here:https://restdb.io/blog/#!posts/579932138783df4400000915