Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8539287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:19:43+00:00 2026-06-11T11:19:43+00:00

https://github.com/wycats/handlebars.js/#registering-helpers In the previous Registering Helpers section they demonstrated creating a single-tag helper: Handlebars.registerHelper(‘link_to’,

  • 0

https://github.com/wycats/handlebars.js/#registering-helpers

In the previous “Registering Helpers” section they demonstrated creating a single-tag helper:

Handlebars.registerHelper('link_to', function(context) {
  return "<a href='" + context.url + "'>" + context.body + "</a>";
});
{{#posts}} <li>{{{link_to this}}}</li> {{/posts}}

Notice that ‘context’ is passed in, and they are able to easily access it’s properties by saying ‘context.url’, ‘context.body’, etc.

https://github.com/wycats/handlebars.js/#block-helpers

Well, in the “Block Helpers” section, they have a similar example, but it seems unnecessarily convoluted:

Handlebars.registerHelper('link', function(context, fn) {
  return '<a href="/people/' + this.__get__("id") + '">' + fn(this) + '</a>';
});
{{#people}} <li>{{{#link}}}{{name}}{{/link}}</li> {{/people}}

First of all, this time they aren’t passing ‘this’ in the opening tag, so how is the helper receiving the ‘context’ param? If Handlebars is passing that in automatically as a convenience, then why doesn’t it do that for the single-tag helpers as well? Then the first example could just use “{{link_to}}” instead of “{{link_to this}}”. What am I missing?

Secondly, if the block helper receives a ‘context’ param, then why can’t it use that the same way as the single-tag helper? Why can’t it say ‘context.id’ instead of the horrific ‘this.get(“id”)’? What am I missing?

I hope this doesn’t seem like picking nits in docs. Compare and contrast is the way I learn to really understand the nature of a thing. Help me replace confusion with understanding. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:19:44+00:00Added an answer on June 11, 2026 at 11:19 am

    I believe the example in the README.md is outdated, there is an issue about it #234 which is still open as of today.

    Take a look at the Block Helpers examples at http://handlebarsjs.com/block_helpers.html … it seems to be current at first glance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The homepage on git for handlebars.js ( https://github.com/wycats/handlebars.js ) talks about a function called
I've installed https://github.com/lleger/Rails-3-jQuery and it worked fine, however, the rails helpers that I was
In https://github.com/Khan/khan-exercises/blob/master/khan-exercise.js there are two var Khan variables. How come? Do they affect each
https://github.com/ono/resque-cleaner this documentation explains how to use the methods in console. what if i
If I use Moonshine (https://github.com/brandonc/moonshine) on non-English characters - for example if I run
I am using Lightbox2 https://github.com/lokesh/lightbox2/blob/master/js/lightbox.js And I don't understand why all the inner members
django guardian https://github.com/lukaszb/django-guardian is a really well written object-level permissions app; and I have
I clone https://github.com/java093/springside4.git and commit local changed files success in eclipse.Then I use Team->Push
I have started using https://github.com/omab/django-social-auth and been successfully able to login via twitter, google
I'm following https://github.com/joyent/node/wiki/Using-Eclipse-as-Node-Applications-Debugger and leaves me with questions How can I see what variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.