Random front page

Hello,

I want to call a random page as front page. How can I achieve this? :flushed:

You can set the home option in your config inside the ready callback:+

Let us say I want to shuffle all projects shown on a website. A project page is a subpage of the projects page.

return [
  'home' => page('projects')->children()->shuffle()
];

As I said, you need to do this within the ready callback, you cannot use the page helper directly with the home option.

Like this?

<?php

return [
    'ready' => function() {
        return [
            'home' => page('projects')->children()->shuffle()
        ];
    }
];

You need to get a single page, though:

 page('projects')->children()->shuffle()->first()
1 Like

Thanks, I will try it.