I currently use tags to categorize content by type: News, Commentary, Media, and so on. I have a Tags page that displays the content types by tag, and works fine.
However, I would also like to use tags for topics. (Or use something for topics.) I don’t want to clutter the tags page with the large number of topics we cover. So, I’m stuck on how to achieve this.
Anyone have an idea on how to assign topics to posts, in addition to the content type? (And, of course, more than one topic per post.)
edit the code of the tags page to only retrieve the content type type tags. (You could keep the list of tags in a custom variable, or you could hard code it, if your content types don’t change regularly.)
or 2) edit the custom-tags.hbs template (or whatever its called in that theme) to ONLY pull tags that are actually applied to that page. (This is one of my favorite theme tricks to produce what looks like collections of tags.)
Cathy – Thanks for the quick reply! Couple of questions:
Don’t understand the “applied to that page” clause. I assume you mean “applied to that post”? Which raises a second question I hadn’t considered: how to display the topics on a post.
Can one use the filter attribute on get to filter an opening string (like a LEFT() function)? I could put “topic-” at the front of the slugs for the topic tags and use that to eliminate them from the category tags loop and include them in the topics loop. Thoughts?
You have a ‘tags’ page in your editor, right, using a custom template?
You could figure out which tags should actually appear on your tags page by reading which tags are on that page. (It’s a bit of a hack, but it works.)
Alright, yeah, you got me to boot up a Ghost instance for that. Ghost Content API Documentation says yes.
(many things that didn’t work deleted) {{#get "tags" filter="slug:~^'fun'"}} TADA!!
(matches everything that starts with fun)
We will NOT be discussing how many permutations of quotation marks that took. Ugh. :)