Meet the {{#split}} helper
Handlebars goes all JavaScript-y
Hey theme creators, this one's for you! I was doing some super snarly handlebars work the other day and complaining about it, which led to addition of the #split helper!
You can use it inline, like this: 🍬
{{#foreach (split "i-like-candy-corn" separator="-")}}
{{#unless @first}}{{#unless @last}}-{{/unless}}{{/unless}}{{#unless @last}}
{{this}}
{{/unless}}
{{/foreach}}
Outputs: i-like-candyYou can use it in block mode, like this:
{{#split "it is almost halloween" separator=" " as |elements|}}
{{#foreach elements}}
{{#unless @first}}🍬{{/unless}}{{this}}
{{/foreach}}
{{/split}}
Outputs: it🍬is🍬almost🍬halloweenYou can also use it to remove unwanted bits of strings, like this:
{{#foreach (split "i-like-candy-corn-it-is-delicious" separator="-corn")}}
{{this}}
{{/foreach}}
Outputs: i-like-candy-it-is-deliciousWhat am I using it for? Alas, it doesn't involve candy. A site I'm working on (launch is NEXT week, stay tuned) that is publishing content in two languages within one Ghost install, and needed to be able to cross-link that content. Their pattern is this-is-the-slug and this-is-the-slug-languagecode and I needed to be able to clip off the -languagecode in a whole variety of situations. While I've resorted to using {{#foreach slug}} and then matched on the @index to remove bits from the front of a slug before, there wasn't a good way to remove bits from the end of a slug. So now there is. Enjoy!
Note: split is live in 6.5.0, but the gscan update that'll make your theme loadable on Ghost Pro will roll out Monday/Tuesday, so if you're on Pro, maybe wait to try until Wednesday? 😃
🎉Just Launched
Remember when I mentioned having a client with a complicated issue setup and then went on to talk about dealing with 1000+ contributors instead? Well, they're launched!
Please join me in welcoming MERIP to Ghost. This was a really interesting site to set up, because they (a) had content going back to 1980 and (b) needed support for issues and (c) the data model over in WordPress was a huge mess, and I ended up scraping much of the content.
They're using a heavily heavily modified version of Homa.

And speaking of tools...
I wrote a tool that creates social sharing links for newsletters! Here's the output:
Share this post
I think I've got cross-platform email support mostly nailed down, but I'd love it if you clicked the buttons and let me know how it goes!
Too bulky? How about this?
