I would like to register a Handlebars/Curlybars helper (for string manipulation). Is this possible?
This is for content in a Help Center landing page. I'm using the {{user_name}} help for personalization, but I really only want to use first name, so I wanted to register a helper function to split that string. It might be easiest explained if I just share the code:
// Get first name string from {{user_name}} token
Handlebars.registerHelper('splitName', function(name) {
var n = name.split(" ");
return n[0];
});
Handlebars.registerHelper('splitName', function(name) {
var n = name.split(" ");
return n[0];
});
I'm just not sure where to put this or if I can register new helpers like in regular Handlebars.
Any advice would be greatly appreciated!
-
Hi Josh, since Curlybars is our serverside implementation of (a subset of) Handlebars you can't unfortunately register new helpers.
サインインしてコメントを残してください。
1 コメント