Gottwik / Enduro

Minimalistic, lean & mean, node.js cms
http://www.endurojs.com/
MIT License
690 stars 121 forks source link

Accessing current context inside custom helper #279

Closed wkosla closed 6 years ago

wkosla commented 6 years ago

I have a problem, I'm trying to solve.

I'm working on a simple blog and I want on each article's page to have anchors to previous and next notes. I figured it would be easy to just copy the example blog helper but use data from current note as a filter to only grab two relevant notes. However I just can't figure out a way to pass context from the current article into the helper. From what I understand, since this is basically a loop, I can't just pass arguments into the helper when I use it on the page. I tried using this keyword, but I don't seem to be getting any data from it.

wkosla commented 6 years ago

I just figured it out. You actually can pass arguments into it, they come up as options.hash object inside the helper.