{"action":"created","issue":{"url":"https://api.github.com/repos/assemble/assemble/issues/837","repository_url":"https://api.github.com/repos/assemble/assemble","labels_url":"https://api.github.com/repos/assemble/assemble/issues/837/labels{/name}","comments_url":"https://api.github.com/repos/assemble/assemble/issues/837/comments","events_url":"https://api.github.com/repos/assemble/assemble/issues/837/events","html_url":"https://github.com/assemble/assemble/issues/837","id":138851495,"number":837,"title":"Nested helper renders $ASYNCID","user":{"login":"johngully","id":879479,"avatar_url":"https://avatars.githubusercontent.com/u/879479?v=3","gravatar_id":"","url":"https://api.github.com/users/johngully","html_url":"https://github.com/johngully","followers_url":"https://api.github.com/users/johngully/followers","following_url":"https://api.github.com/users/johngully/following{/other_user}","gists_url":"https://api.github.com/users/johngully/gists{/gist_id}","starred_url":"https://api.github.com/users/johngully/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johngully/subscriptions","organizations_url":"https://api.github.com/users/johngully/orgs","repos_url":"https://api.github.com/users/johngully/repos","events_url":"https://api.github.com/users/johngully/events{/privacy}","received_events_url":"https://api.github.com/users/johngully/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-03-06T23:52:39Z","updated_at":"2016-03-07T01:29:33Z","closed_at":null,"body":"I'm trying to get an assemble to generate a menu hierarchy.  My understanding is that the `pages` collection isn't available to the templates any longer an that the recommended approach is to create a custom helper.\r\n\r\nI have created two helpers, and they each work independently.  However I need one to be nested within the other, and once I combine them the child intermittently returns an `{$ASYNCID$3$9$}`.  Neither of these helpers are doing any async work.\r\n\r\n### Helpers\r\n`assemble-helpers/menuCategories.js`\r\n```js\r\nmodule.exports = function (categories, options) {\r\n  var value = '<ul>';\r\n  // Logic to match pages to the specified categories list has been removed, and the issue is still present\r\n  var page = { key: \"page key\", data: { title: \"page title\"}};\r\n  value += '<li>' + options.fn(page) + '</li>';\r\n  value += '</ul>';\r\n  return value;\r\n};\r\n```\r\n\r\n`assemble-helpers/menuItems.js`\r\n```js\r\nmodule.exports = function (category, options) {\r\n  var value = '<ul>';\r\n  // Logic to match pages to the specified category has been removed, and the issue is still present\r\n  var item = { key: \"item key\", data: { title: \"item title \"}};\r\n  value += '<li>' + options.fn(item) + '</li>';\r\n  value += '</ul>';\r\n  return value;\r\n};\r\n```\r\n\r\n### Implementation\r\n`template.hbs` \r\n```hbs\r\n<nav>\r\n{{#menuCategories this.patternStructure}}\r\n  <a href=\"{{key}}\">{{data.title}}</a>\r\n  {{#menuItems .}}\r\n    <a href=\"{{key}}\">{{data.title}}</a>\r\n  {{/menuItems}}\r\n{{/menuCategories}}\r\n</nav>\r\n```\r\n\r\nAssemble setup\r\n_This has been modified to read more simply, so there's a possibility for a few typos_\r\n```js\r\nvar options = {} // Removed for simplicity\r\nvar extname = require('gulp-extname');\r\nvar prettify = require('gulp-prettify');\r\nvar assemble = require('assemble');\r\n\r\nvar app = assemble();\r\napp.helpers('/assemble-helpers/*.js');\r\napp.layout('/layouts/test.hbs');\r\napp.partials('/partials/*.hbs');\r\napp.pages('/src/**/*.{hbs,md,tmpl}');\r\n\r\napp.task('processTemplates', function(done) {\r\n  processHandlebarsTemplates(options);\r\n  processMarkdownTemplates(options)\r\n  done();\r\n}); \r\n\r\napp.build('processTemplates', done);\r\n\r\nfunction processHandlebarsTemplates(options) {\r\n  var ext = 'hbs';\r\n  var engine = require('engine-handlebars');\r\n  app.engine(ext, engine);\r\n  app.src('/src/**/*.' + ext))\r\n    .pipe(app.renderFile())\r\n    .pipe(prettify())\r\n    .pipe(extname())\r\n    .pipe(app.dest('/dest'))\r\n    .on('error',  console.log);\r\n}\r\n\r\nfunction processMarkdownTemplates(options) {\r\n  var ext = 'md';\r\n  var markdown = require('gulp-markdown');\r\n  app.src('/src/**/*.' + ext))\r\n    .pipe(markdown())\r\n    .pipe(app.renderFile())\r\n    .pipe(prettify())\r\n    .pipe(app.dest('/dest'))\r\n    .on('error', console.log);\r\n}\r\n```\r\n\r\n### Generated output\r\nSometimes it works\r\n```html\r\n<nav class=\"library__nav\">\r\n  <ul>\r\n    <li> <a href=\"page key\">page title</a>\r\n      <ul>\r\n        <li> <a href=\"item key\">item title</a> </li>\r\n      </ul>\r\n    </li>\r\n  </ul>\r\n</nav>\r\n```\r\nOthertimes it does not\r\n```html\r\n<nav class=\"library__nav\">\r\n  <ul>\r\n    <li> <a href=\"page key\">page title</a> {$ASYNCID$3$9$}</li>\r\n  </ul>\r\n</nav>\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/assemble/assemble/issues/comments/193038213","html_url":"https://github.com/assemble/assemble/issues/837#issuecomment-193038213","issue_url":"https://api.github.com/repos/assemble/assemble/issues/837","id":193038213,"user":{"login":"doowb","id":995160,"avatar_url":"https://avatars.githubusercontent.com/u/995160?v=3","gravatar_id":"","url":"https://api.github.com/users/doowb","html_url":"https://github.com/doowb","followers_url":"https://api.github.com/users/doowb/followers","following_url":"https://api.github.com/users/doowb/following{/other_user}","gists_url":"https://api.github.com/users/doowb/gists{/gist_id}","starred_url":"https://api.github.com/users/doowb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doowb/subscriptions","organizations_url":"https://api.github.com/users/doowb/orgs","repos_url":"https://api.github.com/users/doowb/repos","events_url":"https://api.github.com/users/doowb/events{/privacy}","received_events_url":"https://api.github.com/users/doowb/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T01:29:33Z","updated_at":"2016-03-07T01:29:33Z","body":"@johngully you can [helper-markdown](https://github.com/helpers/helper-markdown#assemble) in handlebars to render the markdown files in the same pass as the handlebars files.\r\n\r\nI'm working on an example of how I would setup the `assemblefile`"}}