Ghost Version: 2.31.0
Configuration: Local install
Browser: Firefox
I’m trying to display a list of posts with a certain internal tag (ex: #projects) on my home.hbs page. For each post, I want to also display the additional tags on that post (ex: Food, Science, etc.). For some reason, the tags don’t display in the below example:
filter="tags:project" should be filter="tag:hash-project" - From what I know, when using tags (plural), you need to pass grouping ([]), but not for tag (not plural). Also, since you’re trying to filter with the internal tag, you need the hash- prefix
Removing the get helper will loop over the home page posts which is why tags are displayed
If you want to also fetch post tags, you need to use include=tags in the get helper
Instead of using the get helper, you can also use Dynamic Routing (just FYI )
Thank you very much! The “include=tags” fixed my problem in the above example. I totally missed this in the documentation - thanks for linking the source.
Oddly enough, this ( filter="tags:project" ) actually worked for me to filter out #project tagged posts. I didn’t need the array or the “hash-” in the front.
Out of curiosity, why are the tags and authors attributes treated differently than other post-related attributes? I looked through here (Ghost Handlebars Theme Helpers: get) under “include”, but that wasn’t really clear to me.
I think it’s because of how the database is designed; authors and tags are many-to-many relationships in separate tables, while most of the other data is part of the posts table and one-to-one