How to Style Certain Posts Differently Using Tags

If you want to change the way that certain posts look on the home page if they have a specific tag, here is how you can do that:

  1. Go to your theme files and open up your index.hbs or if you are using Casper like we are, your loop.hbs file.

  2. We are going to use the #has helper to check to see if the post has a tag, and if it does, we will show the full content of that post.

  3. Add the following code to your theme where you want the specific styling to occur:

     {{#has tag="yourtag"}}
  4. Replace "yourtag" with the tag you want to use and add the code to go with that tag before the else. Add the code you want to use if the post does not have that tag after the else. Example:

  5. Restart Ghost and you will see the changes for the tag!

This will also work inside your post.hbs using the helper the exact same way. Let us know if you have any questions in the comments below.