Routes with featured posts?

Here’s what I want to do:

I want to have two categories of posts ex: Podcasts, Blogs
I want to use routes to create and
I do not want Podcasts or Blogs to appear on the front page unless they are featured.

Could someone help me out with the routes.yaml selector for that? Is this something that might require making a custom index.hbs?

Here’s an example routes.yaml that I worked up that almost does what I’m trying to do:

    permalink: /{slug}/
    template: index
    filter: tag:-blog+tag:-podcast
    permalink: /blogs/{slug}/
    filter: primary_tag:blog
    template: list
    permalink: /podcasts/{slug}/
    filter: primary_tag:podcast

For the index you’re going to want to set the filter to featured:true

based on this tutorial:

I don’t think I can do that. I understand featured:true but I’m not sure how to add it to the filter as “(NOT podcasts AND NOT blogs) OR featured”. That is also going to cause a problem with generating that article’s URL, right?

That’s where I’m stuck.

No you should ONLY need featured:true. That filter by itself should only show posts that are featured regardless of tag. You don’t need to tell it to not show things where featured is false.

Unless you’ve got other primary tags that you want to show that aren’t featured?

I do have other primary tags. I only want to omit the two in the example unless I mark them as featured. Additionally if they are caught in the / collection then I don’t think it will work with both matches creating a route. I think that’s going to have a consequence.

Hrm. I see.
Given what you’re looking for it sounds like featured blog or podcast posts would show up in both the root collection and your blog/podcast collections which means you might run into this issue quoted from the ghost docs:

If posts match the filter property for multiple collections this can lead to problems with post rendering and collection pagination, so it’s important to try and always keep collection filters unique from one another.

So with all that said I think the safest route to avoid any bugs is going to be for you to move your index route out of collections, and not specify a filter, and make use of the {{#get}} helper in your theme to pull down what you want for your index.You’ll want to make your filter on the get like this filter="(tags:[blogs,podcasts]+featured:true),tags:-[blogs,podcasts]"

Sorry it doesn’t seem like you can get by just editing the routes file alone!

Yeah, it definitely doesn’t seem like something I can do with just routes. That’s fine.

Creating a new custom index template got pretty close to what I was doing. The filter doesn’t need to be nearly as in routes. Just a featured:true,tags:-[blogs,podcasts] is good enough.