Search code examples
javascripthtmlhandlebars.jstemplating

Fabricator.js: Is there a way to access material front matter from a child template?


In a fabricator app in my parent.html I have...

---
title: awesome
other: also awesome
---
{{> widgetTemplate}}
{{other}}

And then in my child.html i have something like

<h1>This is {{this.parent.title}}</h1>

I know this.parent.title doesn't work, but anyone know if there is a way to access the title front material from the child template like the parent template accesses its front matter like other without bringing in javascript for each template?


Solution

  • After experimentation instead of front matter I can just define the variables I need on the go in the templating simple as:

    {{> widgetTemplate title="awesome"}}
    

    and then in the template

    <h1>This is {{title}}</h1>