Custom Homepage Error Routes.yaml

Hi there,

I’m trying to custom my homepage and here is my routes.yaml. I want to show all of post at homepage and then in the collection /city/culture i want to show only with them (city and culture).

But my homepage show the permalink to /{slug}, it is like /city/culture is overrided

routes:

collections:
  /:
    permalink: /{slug}/
    template: home
  
  /city/culture/:
    permalink: /city/culture/{slug}/
    template: index
    filter: tag:[city, culture]

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

I use wavy theme

Thanks before.

Collections are exclusive. A post can’t be in two. Flipping the order will get you the URLs you want, but what’s listed as a /: collection should be /blog/ or something. (No need to change the permalinks.

You’ll want a channel for the / route, since you want the city/culture at / also. Check the docs for format.

You’re also going to need to change the filter, since a , means “or”. Try tag:city+tag:culture to require both.

1 Like

finally you save my life. Thanks Cathy. I don’t realize that channel can be used at homepage.

Once again, thank you cathy.

I think it should work! Please report back if it isn’t, including your updated file. :slight_smile:

this is my final routes.yaml and it’s work

routes:
  /:
    controller: channel
    filter: visibility:public

collections:
  /city/culture/:
    permalink: /city/culture/{slug}/
    template: index
    filter: tag:[city, culture]

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

I think you’re going to have a problem with this. Posts that aren’t either city or culture tagged will have no permalink. You’re going to need another collection.

Thanks for the advice Cathy. I’ve anticipated about it. You’re right that it needs to create other collection