Filtering out a tag on main index page

I’m trying to filter out a specific tag from the index page so that the posts with that tag only show up on that tag’s page. I can do this by filtering using routes.yaml, but by excluding a certain tag, when you click on a post that has that tag, it won’t display.

For example, on my website’s homepage, the posts with the tag “filtered-out” (just a test name) are filtered out correctly. When I navigate to “https://…/tag/filtered-out”, I see all of the posts with that tag. When I click on one of those posts however, I get a 404 due to the “/” rule in the routes.yaml to filter out that tag. The URL for each post is “https://…/post-name”. Hopefully that makes sense.

Here’s my routes.yaml:


    permalink: /{slug}/
    template: index
    filter: tag:-TAG_NAME

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