I’ve searched through a lot of threads on this topic and there appears to be no solution.
Say I have 3 tags: photos, videos and audio. They make their own collections page by using tag.hbs (i.e., photos.hbs, videos.hbs, and audio.hbs). All good:
Collections: /photos/ ----> uses photos.hbs to render collection
Furthermore, one can customize things on post-by-post bases either by crreating custom-tag.hbs (i.e. custom-photos.hbs, custom-videos.hbs and custom-audio.hbs) and then assigning them in the UI when creating the post or some custom-{slug}.hbs methods.
However, I have to use the UI to assign custom-photos.hbs . This is not convenient when you have hundreds of posts. It is great for customizing a handful of pages. I think this is an amazing feature already!
Posts by Tag?
There is currently no way to create post.hbs templates that automatically apply to a post with the associated tag.
How am I currently doing it?
I use {{is #tag}} selector in the post.hbs and I have 3 sections in post.hbs, each dedicated to rendering photos, videos and audio.
This one bit of how post.hbs is rendered on per tag basis would make Ghost literally general purpose for doing anything - not just blogging. It already sorta works with the hacky method of using {{is #tag}} in post.hbs.
I am sorry if I have missed some obvious way of doing this? Thank you!
{{#has}} is the correct solution inside post.hbs and can be used however you want - it’s not a hack - that’s exactly what the helper is for.
Ghost is not general purpose, and is not intended to be general purpose. It is specifically intended for publishing and blogging. If you’re looking for a general purpose platform, there are lots of them out there.
@John Yea, I think I am using {{is #tag} or {{#has}}. But doesn’t that feel “hacky”, as in, it goes against the entire composability of the template system? Now my post.hbs looks like a giant switch statement with tons of HTML for all the 3 types of tagged posts want to render.
I very much despise anything that’s out there for a CMS platform. Once I’ve seen how Ghost works and running a blog, man…everything just pales in comparison. I respect the stance that it is a publishing platform, just that it is almost 90% a CMS . Ghost is fricking amazing.