I would like to register a Handlebars/Curlybars helper (for string manipulation). Is this possible? | Community
Skip to main content

I would like to register a Handlebars/Curlybars helper (for string manipulation). Is this possible?

  • February 2, 2023
  • 1 reply
  • 0 views

Josh36
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];
  });
 
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!

1 reply

  • February 6, 2023

Hi Josh, since Curlybars is our serverside implementation of (a subset of) Handlebars you can't unfortunately register new helpers.