You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having a bit of an issue getting the getBlock helpers to work properly. I have modified my docpad.coffee file as instructed in the readme, and the code I used in my layout.html.hbs file looks like this: {{getBlock 'meta'}} so on and so forth, but when I do docpad run, I end up getting [object object] in my output.
I normally use handlebars in my projects, and would prefer to stick to it. Any help would be sincerely appreciated. Thanks.
The text was updated successfully, but these errors were encountered:
I'm getting exactly the same result, and haven't found a way to fix it. Sadly I had to install eco and use it to render getBlock so now I have to use both handlebars and eco on each layout.
I had this problem too, but its quite easy to fix - as per the documentation at https://github.com/docpad/docpad-plugin-handlebars/ you need to add a mapping function for getBlock in your docpad configuration file. Notice how at the end of that mapping function it has .toHTML() - this is what converts the object array to html (which is the first part of your problem).
Then there is another piece to understand, when using your handlebars expression, if you use {{getblock "meta"}}, it will escape the result (and so the .toHTML above) will result in < etc... As is mentioned in the DocPad tutorial for eco, you need to do a similar non-escaping trick in Handlebars and use triple {'s eg: {{{getBlock "meta"}}}, this will then give the result you are after.
Hello,
I am having a bit of an issue getting the getBlock helpers to work properly. I have modified my docpad.coffee file as instructed in the readme, and the code I used in my layout.html.hbs file looks like this:
{{getBlock 'meta'}}
so on and so forth, but when I do docpad run, I end up getting[object object]
in my output.I normally use handlebars in my projects, and would prefer to stick to it. Any help would be sincerely appreciated. Thanks.
The text was updated successfully, but these errors were encountered: