sortBy() not working for unlisted pages in pages section

,

Hi,

I’m trying to sort pages in a pages section using sortBy() with a custom field, but unlisted pages always appear at the end regardless of the sort order.

I have a pages section in site.yml:

sections:
type: pages
options:
type: query
query: site.children.published().sortBy(“num”, “asc”) 

I create a num field in each page blueprint (1, 2, 3… 998, 999). Listed pages sort correctly by num, but unlisted pages (Inicio, Error, Cookies) always appear at the end, as if status sorting overrides the field sorting.

Is there a way to sort all pages (listed and unlisted) together by a custom field, or does Kirby always group by status first?

Thanks,

num is a Page method: $page->num() | Kirby CMS
So your content field num willl be ignored.
Learn about field names: Fields | Kirby CMS