Made it so #mainspace posts show on / but now other posts show 404

This is the website: https://transhumanist.media

I want it so on the homepage (/) that it only show posts with the tag “mainspace” (as in some posts, out of all published posts, make it to the homepage(aka the mainspace).

But posts that do not, aka not tagged with mainspace, do not load now. I even can hover over one(from this author page - Gennady Stolyarov II - Transhumanist Media) and when I hover over a post it shows “https://transhumanist.media/p/8603d684-2e4d-494f-9ce6-f04e15df7baf/” but it should just work and go to “https://transhumanist.media/transhumanism-as-a-grand-conservatism/” (which is what shows in the post settings).

Even when I go to that url(https://transhumanist.media/transhumanism-as-a-grand-conservatism/) directly, it just says 404.

Below is my routes.yml:

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: tag:mainspace

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

How can I make it so all of this works properly? Thank you!

Howdy @joshuniverse,

All posts need to be in a collection somewhere. So what you need is:

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: tag:mainspace
  /other-stuff/:
    permalink: /{slug}/
    template: index

(Rest of the sections unchanged.)

Collections are assigned in order, so your mainspace items (that’s mainspace, not #mainspace*) will go in the / route, and all others in the /other-stuff/ route. (You don’t have to actually link the index at /other-stuff/, and it’s no problem for the permalinks to be the same, if that’s how you want it, but the collection DOES need to exist.)

*Aside: if your tag is actually #mainspace, then you need tag:hash-mainspace in your filter.

p.s. I’ve got a post with some more worked examples here:

1 Like

Thank you, this was exactly what I needed! I will also look over the guides you made.

Also thank you for being such a core contributor to the ghost forums and ecosystem, I’ve seen you so helpful everywhere!

2 Likes