Maybe it could even better be “replacement” of parent link, so that parent would show first child. To avoid redirection. But it would probably need more programming?
You could have a redirecttoggle field in your blueprint, then in your page’s controller:
// site/controllers/page.php
<?php
return function($page) {
// check if the visitor should be redirected
$redirect = $page->redirect()->isTrue();
// get your listed children collection
$children = $page->children()->listed();
// only redirect if $redirect is true and there's at least one listed child
if($redirect && $children->count()) {
go($children->first());
}
};
edit: logic would be the same to echo the link of the child instead of its parent, something like:
In such a case if you want to redirect only after successfully sending the form, place the code where you check for the success of whatever you’re doing with the form data.