Using routes.yaml to filter by post access level

I’m trying to filter the posts on my homepage by post access level - I only want the public content to appear, not the membership content. Does anyone know the syntax for this?

I’ve been guessing it might be something like:

collections:
/:
permalink: /{slug}/
template: index
filter: post_access:public

…but so far all I get is the 404 of doom.

Note: have also tried ‘visibility:free’ and ‘visibility:public’.

Hi!

visibility:public is the property you want. I just tested it and only public posts appeared on the homepage.

Are you able to share your whole routes.yaml file? Remember that whitespace is crucial, so you need to ensure proper formatting for everything to work as expected.

2 Likes

Thank you!

I ended up with:

collections:
/:
permalink: /{slug}/
template: index
filter: ‘visibility:public+tag:-notthistag’
order: published_at desc

Works great :slight_smile:

2 Likes