# Custom theme hbs helper

**URL:** <https://forum.ghost.org/t/custom-theme-hbs-helper/4038>\
**Category:** Ideas\
**Created:** [November 13, 2018, 2:24am UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038 "2018-11-13T02:24:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zce](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zce/32/1175_2.png) [@zce](https://forum.ghost.org/u/zce)\
**Post date:** [November 13, 2018, 2:24am UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/1 "2018-11-13T02:24:51Z")

</div>

**Feature request**

Consider adding a custom helper feature?

like this

```diff
 .
 ├── /assets
 | └── /css
 | ├── screen.css
 | ├── /fonts
 | ├── /images
 | ├── /js
+├── /helpers
+| ├── helper1.js
+| └── helper2.js
 ├── default.hbs
 ├── index.hbs [required]
 └── post.hbs [required]
 └── package.json [required]

```

or

```diff
 .
 ├── /assets
 | └── /css
 | ├── screen.css
 | ├── /fonts
 | ├── /images
 | ├── /js
 ├── default.hbs
+├── functions.js
 ├── index.hbs [required]
 └── post.hbs [required]
 └── package.json [required]

```

In this way, we can add more advanced features to the theme more easily.

If there is no problem, I can contribute the pr code.

---

<div class="post-metadata">

**Author:** ![joakimkm](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/joakimkm/32/1896_2.png) [@joakimkm](https://forum.ghost.org/u/joakimkm)\
**Post date:** [November 15, 2018, 10:01pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/2 "2018-11-15T22:01:55Z")

</div>

It’s easy to add custom helpers with Ghost-App module.  
Use npm install ghost-app.  
Guide has been removed, but you find it here:  
[https://web.archive.org/web/20181006220559/https://github.com/TryGhost/Ghost/wiki/Apps-Getting-Started-for-Ghost-Devs](https://web.archive.org/web/20181006220559/https://github.com/TryGhost/Ghost/wiki/Apps-Getting-Started-for-Ghost-Devs)  
And a example here:

> **[GitHub - TryGhost/Ghost-App: Includes for Ghost Apps](https://github.com/TryGhost/Ghost-App)**
>
> Includes for Ghost Apps. Contribute to TryGhost/Ghost-App development by creating an account on GitHub.

This tutorial is also useful:

> **[Using Ghost Apps to Add Custom Handlebars Helpers To Your Theme](https://www.triplet.fi/blog/using-ghost-apps-to-add-custom-handlebars-helpers-to-your-theme/)**
>
> Ghost blogging platform theming support gives us plenty of built-in blog and post related Handlebars helpers. There are cases where built-in helpers are not enough and we need a way to apply custom helper. In this blog post, I'll show you how new...

---

<div class="post-metadata">

**Author:** ![zce](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/zce/32/1175_2.png) [@zce](https://forum.ghost.org/u/zce)\
**Post date:** [November 20, 2018, 8:10am UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/3 "2018-11-20T08:10:09Z")

</div>

I know this method, but I think it would be better to put these helpers in the theme.

---

<div class="post-metadata">

**Author:** ![cmckulka](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmckulka/32/2965_2.png) [@cmckulka](https://forum.ghost.org/u/cmckulka)\
**Post date:** [April 5, 2019, 5:59pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/4 "2019-04-05T17:59:07Z")

</div>

I added my vote to this but wanted to add a comment as well.

I was hoping to suppress pagination when there is only one page, e.g. for featured posts.

The `if` helper won’t work because `pages` is always at least 1 (if nothing featured I suppress the whole section). `has` doesn’t help here either.

I would add something like this - [if statement - Check for a value equals to in Ember Handlebar If block helper - Stack Overflow](https://stackoverflow.com/questions/11169595/check-for-a-value-equals-to-in-ember-handlebar-if-block-helper/39249054#39249054).

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [April 5, 2019, 6:12pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/5 "2019-04-05T18:12:42Z")

</div>

@cmckulka how to suppress pagination will depend on how you are rendering pagination but if you’re talking about the code inside `pagination.hbs` have you tried using the [`{{has}}` helper](https://docs.ghost.org/api/handlebars-themes/helpers/has/)? Eg: `{{#has any="prev, next"}}...pagination...{{/has}}`

There shouldn’t be any need for custom helpers for what you are trying to do. If the `{{has}}` helper doesn’t work please open a new topic with more details about your template structure and exactly what you are trying to achieve.

---

<div class="post-metadata">

**Author:** ![cmckulka](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmckulka/32/2965_2.png) [@cmckulka](https://forum.ghost.org/u/cmckulka)\
**Post date:** [April 5, 2019, 6:14pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/6 "2019-04-05T18:14:42Z")

</div>

Thanks, I’ll try that. I didn’t realize that `{{#has any="prev, next"}}` would work.

Would still love to add custom helpers though!!

---

<div class="post-metadata">

**Author:** ![cmckulka](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmckulka/32/2965_2.png) [@cmckulka](https://forum.ghost.org/u/cmckulka)\
**Post date:** [April 5, 2019, 6:16pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/7 "2019-04-05T18:16:54Z")

</div>

Thanks very much for the quick response!!

---

<div class="post-metadata">

**Author:** ![ramrami](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ramrami/32/12955_2.png) [@ramrami](https://forum.ghost.org/u/ramrami)\
**Post date:** [May 10, 2021, 2:04pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/8 "2021-05-10T14:04:26Z")

</div>

I would like to add my vote to this. Something as simple as an `eq` helper would make theme development much easier.

---

<div class="post-metadata">

**Author:** ![xtabbas](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/xtabbas/32/7696_2.png) [@xtabbas](https://forum.ghost.org/u/xtabbas)\
**Post date:** [September 12, 2021, 1:25pm UTC](https://forum.ghost.org/t/custom-theme-hbs-helper/4038/9 "2021-09-12T13:25:46Z")

</div>

Here is a guide I wrote on similar topic, if anyone needs it.

> **[Add a custom HBS helper to your Ghost Blog](https://xtabbas.com/add-a-custom-hbs-helper-in-your-ghost-blog/)**
>
> Add custom HBS helpers to your ghost blog to develop your ghost blog theme.
