Skip to content

Commit

Permalink
Make data imported from external files available globally
Browse files Browse the repository at this point in the history
  • Loading branch information
gakimball committed Nov 15, 2015
1 parent c89dbff commit cc098ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ module.exports = function(file, enc, cb) {
pageData = page.attributes;
pageData = extend(pageData, {
page: path.basename(file.path, '.html'),
root: processRoot(file.path, this.options.root),
data: this.data
root: processRoot(file.path, this.options.root)
});
pageData = extend(pageData, this.data);

// Add special ad-hoc partials for #ifpage and #unlesspage
this.Handlebars.registerHelper('ifpage', require('../helpers/ifPage')(pageData.page));
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ <h2>Index file!</h2>
<li>Item!</li>
{{/repeat}}
</ul>

{{#each data}}
{{ this }}
{{/each}}

0 comments on commit cc098ec

Please sign in to comment.