Matching of data files to pages

198 views Asked by At

I have used the assemble/boilerplate-site as a test bed. Following the examples on http://assemble.io/docs/Data.html I have created a page named test.hbs and a data file named test.yml.

The yaml file contains:

title: stuff

when running grunt assemble, a test.html page is assembled into the destination directory. if my test.hbs contains the tag {{title}} the title is not added from the data file, however a tag of {{test.title}} does add the title from the data file.

on the docs page http://assemble.io/docs/options-data.html it states:

When using "external" data files (versus YAML front matter), if name of the data file is the same as the associated template then Assemble will automatically associate the two files.

I also need to use the {{title}} tag in my layout. This works if I use YFM at the top of the page rather than an external data file.

Am I misunderstanding how external data files are associated with a page or am I missing something?

1

There are 1 answers

0
doowb On BEST ANSWER

You can use {{page.title}} in your test.hbs and layout.hbs files to access the variable without having to specify the actual page name.