How can I exclude tags when I want to show the tag lists?

I am trying to exclude some tags from my tag lists. I used it before but when I updated my ghost and ghost-cli with latest version (2.11.1), the tags exclude is not working.

I am trying to do with this code but it is not working

{{#get "tags" filter="tags:-[purple]"}}
   {{#foreach "tags"}}
       <li><a href="{{url}}">{{name}}</a></li>
   {{/foreach}}
{{/get}}

I think you have a typo.

{{#foreach “tags”}}

Must be

{{#foreach tags}}

Let me know if it works.

If I use this, it shows all tags. But I want to exclude the “purple” tag or like this which I use in the array notation.

{{#get "tags" filter="tags:-[purple]"}}
   {{#foreach tags}}
       <li><a href="{{url}}">{{name}}</a></li>
  {{/foreach}}
{{/get}}

You have to use e.g.

{{#get “tags” filter=“slug:-purple”}}

1 Like

Great :blush: Thank you so much

1 Like

Hi @Kate, I am using ghost version 3 and I cannot use
{{#get “tags” filter=“slug:-news”}}

It is still showing News on tag list page.

OK it works now. Ghost docs should mention to use single quotes around and not double quotes. This is how it works in version 3. I don’t know about previous versions.

This works
{{#get 'tags' filter='slug:-news'}}

1 Like

It looks like the version you pasted was using smart quotes which don’t work, but both double and single quotes should work

And for anyone else, the issue above about using array notation IS doable.
You negate the array, not each item. So mind those single quotes and:
filter:'slug:-[news, some-other-tag, a-third-tag]'

2 Likes