{{tags}} shows all tags on page even if it is a duplicate
For example I have 3 post with one tag for each: Ghost, JavaScript, Ghost. I want to display them on the page and get not repeating result: Ghost (only one) and JavaScript. But after folowing code I get two Ghost tags.
// It will displays all tags on page even if it is a duplicate
{{#foreach tags}}
{{#if tags}}
{{tags separator=" | "}}
{{/if}}
{{/foreach}}
How I can do what I want?
Hi @Pestov,
It's not really clear on first read if you're reporting a bug here, or if you have a question. I have a feeling that you're trying to output a list of all tags for all posts, which is currently not possible (you need to wait for this feature ).
However, if you're actually getting duplicates for a single post, then can you please update your issue with a few more details, including an extended code snippet? We have a handy bug template in our contributing guidelines that should help you to know what info to include.
Hi @ErisDS, It was a question and I don't understand is it bug or logically true. So, on the many WordPress sites you could see all existing tags in sidebar (tag cloud). I want to do similar. But if I have posts, which contains equal tags, then {{tags}} helper will displays all of them.
For example I have posts and tags for it:
Post 1 / HTML, CSS Post 2 / JS, CSS Post 3 / PHP, HTML
On output I want to get just only 4 tags: HTML, CSS, JS, PHP.
{{#foreach tags}}
{{#if tags}}
{{tags separator=" | "}}
{{/if}}
{{/foreach}}
But this code displays HTML, CSS, JS, CSS, PHP, HTML. I won't to display repeating tags.
Ah ok, then what you're attempting to do is not possible yet. Ghost doesn't support outputting a list of your tags yet. You'll need to wait for the {{get}} helper as described in this issue: https://github.com/TryGhost/Ghost/issues/4439.