Exclude a tag from showing in the main loop

Hello!

I want to exclude the tag ‘news’ from the main page but I want to create it’s own page with it’s own format, like a customised loop.hbs but news.hbs, then add it to the navigation https://example.com/news/

Is this possible?

Yep! There are a couple of different ways to do this, but I like using a custom route for this.

In routes.yaml, you’d create a custom collection like this:

## routes.yaml

routes:

collections:
  /news/:
    permalink: /news/{slug}/
    template: index ## or define custom template to use
    filter: tag:news
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-news

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

I was on the right track but this helped me get there!

Thanks for your help Ryan!

1 Like