Hey, I’m working on an import script for blog posts coming from Hugo to Kirby 4. I managed to create posts programmatically and have them show up as “unlisted”. This I believe is because they don’t have any sorting number. When I rename the directory of the post and prefix it with an integer it shows up as published and also updates if I’m changing the order in the panel.
Currently I’m generating the posts with the following code:
$child = $parent->createChild([
'slug' => $slug,
'draft' => $draft,
'num' => $index,
'template' => 'post',
'content' => [
'title' => $title,
'blocks' => json_encode($blocks->toArray()),
'date' => $date
]
]);
I also tried using the update function like:
$child->update([
'num' => 15,
]);
None of these is generating a directory name prefixed by 15 though. What’s the best way to programmatically generate the sorting number?
Thanks!