You can use the #has helper anywhere, but if you’re checking if a post has something then you’ll need to wrap it inside a {{#post}} {{/post}} so the #has helper has the right context.
By the way I am doing this because I was trying to create another file only for the project pages like project.hbs but I couldn’t connect the posts with tag work with the project.hbs so that’s why I am doing this but temporary.
I see. Looks like your routes file is ok. So would I be right in saying you wanted to create a “related projects” section within a single project? Have you looked into custom templates? You can create new post templates called custom-project.hbs and then you’ll be able to select the template in the Ghost admin, there’s more info on it here:
Additionally, do you need the #has check? If you’re trying to get related posts then surely it’ll only get the posts that have any tags the same as the currently viewed one? For example a project post will only have project posts related to it
I was doing the wrong thing with custom templates, for a moment I thought custom was a wildcard but it’s not and now it’s working, I am using that custom-project… Ghost is more powerful than I thought.
No problem! Also I’ve spoken with a colleague and there was a missing change to the code I supplied. Here’s what you should do when using post data inside of {{#post}}{{/post}}:
Ah, that’ll be because {{tags}} renders the anchor link around the tag string. Check out our docs where it shows how you use tags in handlebars templates and how to loop through them to render out specific parts: