Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{tags}} shows all tags on page even if it is a duplicate #4971

Closed
Pestov opened this issue Mar 1, 2015 · 3 comments
Closed

{{tags}} shows all tags on page even if it is a duplicate #4971

Pestov opened this issue Mar 1, 2015 · 3 comments

Comments

@Pestov
Copy link

Pestov commented Mar 1, 2015

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?

@ErisDS
Copy link
Member

ErisDS commented Mar 1, 2015

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.

@Pestov
Copy link
Author

Pestov commented Mar 1, 2015

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.

@ErisDS
Copy link
Member

ErisDS commented Mar 1, 2015

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: #4439.

@ErisDS ErisDS closed this as completed Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants