## Usage This middleware will work with [assemble][], [verb][], [generate][], [update][] or any other node.js application based on the [templates][] library. ```js var pageData = require('{%= name %}'); var assemble = require('assemble'); var app = assemble(); app.onLoad(/\.md$/, pageData(app)); var page = app.page('home.md', { contents: new Buffer('---\ntitle: Home\n---\n\nThis is {{page.title}}') }); app.render(page, function(err, view) { if (err) return console.log(err); console.log(view.contents.toString()); //=> 'This is Home' }); ``` Then, inside templates you can use the variable like this: ```handlebars --- title: Home --- This is the {{page.title}} page. ``` Which would render to: ```html This is the Home page. ``` ## Custom variable Optionally specify a custom property name to use instead of `page`. ```js // you don't need to create a custom collection too, this is just an example app.create('posts'); app.onLoad(/\.md$/, pageData(app, 'post')); var post = app.post('home.md', { contents: new Buffer('---\ntitle: Home\n---\n\nThis is {{post.title}}') }); app.render(post, function(err, view) { if (err) return console.log(err); console.log(view.contents.toString()); //=> 'This is Home' }); ```