Having some issues with TAGs and Routing

Hey there, bascially i have a ghost blog website and i have a tags named case-studies and blog
I want posts with tags to have tags in url and posts with no tags have no tags in url

so i came up with this

routes:
  /about/: about
  /contact/: contact
  /: index
    
collections:
  /case-studies/:
    permalink: /case-studies/{slug}/
    template: case-studies
    filter: primary_tag:case-studies
  /blog/:
    permalink: /blog/{slug}/
    template: blog
    filter: primary_tag:blog
  /:
    permalink: /post/{slug}/
    template: index
    
taxonomies:
  tag: /all/{slug}/

now issue with that is when i am adding the / collection all posts are going on / and when i remove the / part and keep other posts with tags go to their tags in url but then the posts without a tag break and their links become something like this /p/9a8a0d9f-2d7f-4f7b-8a84-77813762f878/

and then when i click on it, it just sends to 404 page

You need to remove the blog and case studies posts from the index collections by adding the filter: "tags:-case-studies+tags:-blog"

Try

routes:
  /about/: about
  /contact/: contact
  /: index
    
collections:
  /case-studies/:
    permalink: /case-studies/{slug}/
    template: case-studies
    filter: primary_tag:case-studies
  /blog/:
    permalink: /blog/{slug}/
    template: blog
    filter: primary_tag:blog
  /:
    permalink: /post/{slug}/
    template: index
    filter: "tags:-case-studies+tags:-blog"
    
taxonomies:
  tag: /all/{slug}/
1 Like

Thank you alot! this works! <3

1 Like