Upgrade from Kirby 1 Broke the Homepage

Hey there, I just upgrade to Kirby 2 and it’s caused my homepage to break. I was pulling in my latest blog post as the hero story and then showing a list of the next 3 blog post to give people a chance to see what was written earlier.

I’m guessing there was just enough of a syntax change that I just need to restructure my query, but I can’t find exactly what I’m looking for in the docs.

Here are the queries in question:
<?php $heroPost = $pages->findByUID('blog')->children()->visible()->flip()->first() ?>

and

<?php foreach($pages->findByUID('blog')->children()->visible()->flip()->offset(1)->limit(3) as $bloglinks): ?>

Was findByUID used that way deprecated?

Any pointers in the right direction are appreciated. Thanks!

You can use findBy() instead:

<?php $heroPost = $pages->findBy('uid', 'blog')->children()->visible()->flip()->first() ?>

Or simply:

<?php $heroPost = page('blog')->children()->visible()->flip()->first() ?>

And the same in your foreach-loop.

That did the trick. Thanks!