How to pass parameters to default template?

like below:

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

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

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

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

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

The contentFor / block helper is your best bet

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

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:

block:

1 Like

thank you very much, help a lot!