Add classes to tags helper output

Currently the tags helper just outputs everything as plaintext with the tag text items wrapped in links if “autolink” is on (which is the default). If you want to customize how the tags are displayed, you need to override that yourself in your theme code. One problem here is an issue with the {{#if tags}} handler: if the only tags are internal tags, that still evaluates to True.

But enhancing the tags helper to embed a default class name into its output will go a long way to helping theme writers customize the tag helper’s output while still leaving the option open for a complete override if that’s desired.

Specifically, I’d like to see this:

  1. Wrap the prefix and suffix in separate span elements, with the class set as “post-tag-prefix” and “post-tag-suffix”, respectively.
  2. If the prefix or suffix is not set, the respective span tag is omitted.
  3. Add the class “post-tag” to each tag that is output. Add it to the anchor (“a”) tag if autolink is on, wrap the tag text in a span tag with the class if autolink is off.
  4. If there are no tags to display per the visibility parameter, nothing is output, per current behavior.

I have also already this implemented this in my test Ghost environment. The class names I derived from what I saw in some of the free Ghost themes, so if a different nomenclature is desired, I’m open to suggestions.