Filtering Collection by Custom Template not working?

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: custom_template:-custom-game-hub
  /game/:
    permalink: /game/{slug}/
    template: index
    filter: custom_template:custom-game-hub

This isn’t working. Using filter=custom_template:custom-game-hub in the Content API successfully returns posts, but if I navigate to one of said posts, it does not have the /game/ URL scheme.

Should this work? If not, why? And how could I make it work?

I’m not sure if you can filter on custom_template for routing. I agree that the docs say you can “use the full power of the content api”, but that might not be perfectly true.

An alternate approach would be to use tags instead. You could retain the custom template, or you could actually just change what post.hbs does, based on the presence or absence of that tag.

1 Like

I think the fields you can’t filter on are listed here:

1 Like

Interesting. Any particular reason why?

Probably because of they are not indexed columns in the database, so searching with them would cause performance issues.