Maybe I’m misunderstanding something but from my understanding doesn’t the ($page = $site->children()->find(‘contact’)) check whether a page exists no matter its status? If it only checks pages which are published, what’s the difference between that and isListed().
Because a page can only have the status “listed” if it’s existing anyways, no?
In your first example, you use an if statement but you already add the isListed() method to the chain without first checking if you have a page object.
The thing to understand here is that class methods require an existing instance of that class.
A published page can have two statuses: either listed or unlisted. An unpublished page is a draft.
Ah ok, so I misunderstood the difference between a draft and a listed/unlisted status.
Because I thought a status “unlisted” actually means the page is a draft. What’s the difference then (sorry for asking).
Apparently I overlooked the isDraft(). So from my understanding isDraft() needs a page existence check too.
A listed page is a page with any kind of sorting number, either manual like 1_xxx, or 0_xxx for alphabetical sorting or 20191211_ for date based sorting. An unlisted page doesn’t have a sorting number but is still available via its URL. A draft is only visible for logged in users.