Routes collections file doesn't update content

Hello.

I want to set posts with tag that has slug “instruktsii” to be at separate page https://www.website.ru/instruktsii/ and won’t be at my homepage.

So I set collections in routes.yaml file.

collections:
  # Homepage
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-hash-blog-instruktsii
  # Blog
  /blog/:
    permalink: /{slug}/
    template: blog
    # data: page.blog # When active data will be taken from the  "/blog/" page
    filter: tag:hash-blog
  # Instruktsii  
  /instruktsii/:
    permalink: /instruktsii/{slug}/
    template: custom-instruktsii
    # data: page.instruktsii # When active data will be taken from the  "/instruktsii/" page
    filter: tag:instruktsii

I uploaded file, but nothing happened, all posts are at my home page.

Collections are mutually exclusive, which means that a post can’t live on more than one. Right now, your collections read like this:

  • On the homepage, don’t show posts with the #blog-instruktsil tag.
  • On /blog/, only show posts with the #blog tag.
  • On /instruiktsii/, show posts with the instrukstsii tag.

The problem is that posts with instrukstsii are already showing up on the homepage collection. Instead, you should include something like this:

filter: -[hash-blog-instruktsii,instruktsii]

See Filter property not working as expected in route.yaml - Ghost Developers for more info.

2 Likes

Thank you!!
This issue is resolved. My solution was:
collections:

Homepage

/:
permalink: /{slug}/
template: index
filter: tag:-hash-blog+tag:-instruktsii+tag:-projects

Blog

/blog/:
permalink: /{slug}/
template: blog
# data: page.blog # When active data will be taken from the “/blog/” page
filter: tag:hash-blog

Instruktsii

/instruktsii/:
permalink: /instruktsii/{slug}/
template: index
# data: page.instruktsii # When active data will be taken from the “/instruktsii/” page
filter: tag:instruktsii

Projects

/projects/:
permalink: /projects/{slug}/
template: projects
# data: page.instruktsii # When active data will be taken from the “/projects/” page
filter: tag:projects

2 Likes