Search site for specific field

Hi all, I know this question probably has a really simple answer but my php skills are pretty limited. I have a site that needs some reworking and I don’t want to have to completely restructure the backend. Throughout the site there are certain pages that I want to be able list on a new page. My thinking is that by having a switch on the blueprint ‘add this page to new listing’ I could then do a site wide search along the lines of

$site->pages()->fieldname()->isNotEmpty() as $newlist

the logic seems sound in my head but am I missing something really obvious and can anyone point me in the right direction?

Thanks in advance


Try this:

$listing = $site->index()->filterBy('fieldname', 'yes');

Could be ‘true’ instead of ‘yes’, depending on field …

Thanks , that’s great :slight_smile: