I have this Handlebar code in an Express project:
{{#if user}}
<p>Welcome, <a href="/profile/{{user.[_id]}}">{{user.username}}</a>.</p>
{{#each user.snippets}}
{{log 'heading' this.heading}}
<h1>{{heading}}</h1>
<code>{{code}}</code>
{{/each}}
The username is output correctly, and the loop is executed the right amount of times (which I see from the logging). However, the string properties heading and code are undefined, even though they are correctly set in my database. Both user and snippets are Mongoose objects or schemas (I am not sure about the terminology), or rather snippets (a property of users) is an array of such objects.
I am not a 100% sure if I'm using the this keyword correctly, or if I need brackets. I have also tried helpers, but they don't seem to do what I want. Any suggestions?