# How to pass parameters to default template?

**URL:** <https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295>\
**Category:** Themes\
**Created:** [January 27, 2019, 2:53am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295 "2019-01-27T02:53:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmlanche](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmlanche/32/1333_2.png) [@cmlanche](https://forum.ghost.org/u/cmlanche)\
**Post date:** [January 27, 2019, 2:53am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/1 "2019-01-27T02:53:32Z")

</div>

like below:

```
{{!< default test="dddd"}}

```

how to pass? I tried above, but seems no work

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [January 27, 2019, 3:04am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/2 "2019-01-27T03:04:57Z")

</div>

You can’t pass parameters to the default template because it’s not actually handlebars. The library that Ghost uses ([express-hbs](https://github.com/barc/express-hbs)) checks if you declared a layout separately.

If explain your usecase, someone might be able to give you a different solution

---

<div class="post-metadata">

**Author:** ![cmlanche](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmlanche/32/1333_2.png) [@cmlanche](https://forum.ghost.org/u/cmlanche)\
**Post date:** [January 27, 2019, 3:24am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/3 "2019-01-27T03:24:57Z")

</div>

different page has different js, css file, if just put these into default template directly , you need write a lot of if else, i think it was dirty, if I can pass from page, it will be better

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [January 27, 2019, 3:26am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/4 "2019-01-27T03:26:48Z")

</div>

The `contentFor` / `block` helper is your best bet

> **[GitHub - TryGhost/express-hbs: Express handlebars template engine with...](https://github.com/TryGhost/express-hbs#syntax)**
>
> Express handlebars template engine with inheritance, partials, i18n and async helpers. - GitHub - TryGhost/express-hbs: Express handlebars template engine with inheritance, partials, i18n and async...

---

<div class="post-metadata">

**Author:** ![cmlanche](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmlanche/32/1333_2.png) [@cmlanche](https://forum.ghost.org/u/cmlanche)\
**Post date:** [January 27, 2019, 3:43am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/5 "2019-01-27T03:43:09Z")

</div>

is ghost use ‘express-hbs’ default ? so I can use  
{{#contentFor “pageScripts”}}  
CONTENT HERE  
{{/contentFor}}  
without install it any more ?

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [January 27, 2019, 3:47am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/6 "2019-01-27T03:47:14Z")

</div>

I’m not sure I understand your question.

The `contentFor` helper is added by express-hbs so you don’t need to do anything special to your installation to make it work.

You can see an example of how this helper is used in Casper:

contentFor:

> <https://github.com/TryGhost/Casper/blob/9ababa2886688fade337ae3cb8c797238f4e14fb/post.hbs#L146-L211>

block:

> <https://github.com/TryGhost/Casper/blob/9ababa2886688fade337ae3cb8c797238f4e14fb/default.hbs#L83>

---

<div class="post-metadata">

**Author:** ![cmlanche](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cmlanche/32/1333_2.png) [@cmlanche](https://forum.ghost.org/u/cmlanche)\
**Post date:** [January 27, 2019, 3:55am UTC](https://forum.ghost.org/t/how-to-pass-parameters-to-default-template/5295/7 "2019-01-27T03:55:02Z")

</div>

> [@vikaspotluri123](#):
>
> scripts

thank you very much, help a lot!
