Hello, good day to everyone.
I wanted to see if anyone could support me with their Ghost experience on whether what I’m doing is okay or if there is a better way to do it.
Currently all my templates take default.hbs
as a reference to build. In this file I check what type of page it is on, in order to load the correct assets.
{{#is "bits"}}
<link rel='stylesheet' href='{{asset "styles/bit-bundle.css"}}'>
{{/is}}
{{#is "videos"}}
<link rel='stylesheet' href='{{asset "styles/video-bundle.css"}}'>
{{/is}}
...
I ran into the problem that I have post.hbs
and also custom-post-name.hbs
in which I want to load other types of scripts, that’s why I did the following:
{{#is "post"}}
{{#post}}
{{#has tag="blog"}}
<link rel='stylesheet' href='{{asset "styles/post-bundle.css"}}'>
{{/has}}
{{#has tag="bit"}}
<link rel='stylesheet' href='{{asset "styles/postBit-bundle.css"}}'>
{{/has}}
{{/post}}
{{/is}}
Is there a better way to do this? Maybe something like {{#has custom-post-name}}
or would it be better to create another default-custom-post.hbs
file?
Thank you in advance for your comments.