Getting 404 error on individual articles on tag page

I have navigation set up to show a page for a specific tag The Weekly - Plain AI. When I navigate to that page, I can see all of the posts related to that tag. However when clicking on an individual post I get a 404 error. I think I can see the problem, but I don’t quite know how to solve it.

I can see that the URL for each individual post is:

https://www.plainai.co.uk/p/bf3c0968-7bb5-40ba-a28f-6fe443f4c2d1/

But shouldn’t it be more like the following?

https://www.plainai.co.uk/tag/the-weekly/bf3c0968-7bb5-40ba-a28f-6fe443f4c2d1/

My current routes.yml is as below, where I’m excluding ‘the-weekly’ from the home page:

routes:

collections:
  
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[hide, the-weekly]

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

Posts that aren’t part of any collection don’t have a url assigned and fall back to that preview style link. If you add another collection that includes them, that’ll stop them from the weird urls.

1 Like

Bingo!

This did the trick:

collections:
  
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[hide, the-weekly]
  
  /the-weekly/:
       permalink: /the-weekly/{slug}/

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