Change page status to 'listed' with alphabetical order

Hello!

I am calling this on a site with many pages.

$page.changeStatus('listed', 0);

expecting to see directories renamed to

0_title-a
0_title-b

as described in the Publishing Workflow on the Kirby site as a way to get alphabetical order (Editing & publishing workflow | Kirby CMS)

Instead I get:

1_z
2_q
3_a
4_c
…

Which is essentially random.

Is there a method to list pages with 0_ as a leading number?

Not a massive deal, as I can sort in a controller, but the changeStatus() method appears to give somewhat random results when it comes to sorting.

Any clue?

You have to set the sorting scheme to zero in your blueprint and not pass a number as argument.

And your syntax needs an arrow in PHP, not a dot. So should be

$page->changeStatus('listed');

Thank you @texnixe I didn’t know about the num prop in the Blueprint. Does that affect the Panel sorting too?

Ref arrow syntax: just a forum typo, sorry for the confusion!

Regarding not passing a number… I was confused by the docs at $page->changeStatus() | Kirby CMS

image

I see int… I pass int. But reading through the Kirby code, there some input normalization going down the chain and 0 is converted to 'zero', and to add to that 0 is flat out ignored unless the Blueprint says it’s OK. Bit confusing which gear is in control of what there :slight_smile:

I understand the reference docs are auto-generated. Definitely an area of Kirby that needs improvement I think from the perspective of a new user like me learning its APIs.