How can I filter multiple tags in routes.yaml file?

Hi,
I am trying to filter multiple tag post from index page but I can only one. If I want to use more, it is showing error to upload.

I tried like this

routes:

collections:
    /:
        permalink: /{slug}/
        template: index
        filter: 
            - 'tag:-hash-cn'
            - 'tag:-hash-jp'
            - 'tag:-hash-ko'
    /cn/: 
        permalink: /cn/{slug}/
        template: cn
        filter: 'tag:hash-cn'
    /jp/: 
        permalink: /jp/{slug}/
        template: jp
        filter: 'tag:hash-jp'
    /ko/: 
        permalink: /ko/{slug}/
        template: ko
        filter: 'tag:hash-ko'

taxonomies:
    tag: /tag/{slug}/
    author: /author/{slug}/

I think it is a wrong way. Can you anyone tell me the right way?

Thanks

1 Like

You can only have one filter per collection, but it can have multiple criteria.

filter: tag:-hash-cn+tag:-hash-jp+tag:-hash-ko

Check out these resources for more info:

https://ghost.org/tutorials/multi-language-content/

1 Like

Hello :smile: @StuartMorrisAU @ENAMUL_HAQUE

I think this is the right way to perform

routes:

collections:
    /:
        permalink: /{slug}/
        template: index
        filter: tag: -[hash-cn, hash-jp, hash-ko]

https://ghost.org/docs/api/v3/handlebars-themes/routing/channels/#creating-a-channel

the solution is not working. This error is showing

This is not working

Hi @ENAMUL_HAQUE

Excuse me.

I made the mistake of giving an extra space.

This works fine.

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[hash-cn,hash-jp,hash-ko]
  /cn/: 
    permalink: /cn/{slug}/
    template: cn
    filter: 'tag:hash-cn'
  /jp/: 
    permalink: /jp/{slug}/
    template: jp
    filter: 'tag:hash-jp'
  /ko/: 
    permalink: /ko/{slug}/
    template: ko
    filter: 'tag:hash-ko'

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

:smile: Good luck.

2 Likes

Thank you for this :slight_smile: