Nested/hierarchical tags, subtags



As recently discussed on Slack, hierarchical tags and subtags would be very useful for tags like:

  • United States > California > San Francisco
  • People > Philosophers > Bertrand Russell

That would allow links to parent and children tags from the tag pages. Just that would be enough and great, there is no need for long nested URLs with multiple tags, the current URLs are OK in the case of tags. (Of course more general publishing channels or sections like “News”, “Opinion”, etc. would be a different, complementary case with specific channel URLs).

All what is needed for the hierarchical tags functionality is the parent_id field that already exists -though not yet used- in Ghost’s tags database table, and also people hopefully contributing pull requests to make possible the use of the parent_id field.

The PRs to use the parent_id field could create, for example, a “Parent” input field for tags in admin, an e.g. tagTree object in memory with parents and children, and {{parent_tag}} and {{children_tags}} helpers for the tag links on theme templates. That would be one of the possible ways.

Linked/related tags
Child and parent tags
Child and parent tags

Nice - we’re definitely going to do this!

I18n and custom theme