Roots Discourse

Load Search template for an empty search?

I’ve run into a strange templating issue that seems like it should be simple. WordPress loads the front-page template in response to a blank search query. How can I instruct Sage (somewhere in app.blade.php ?) to return the search template instead?

Ah ha… It was Soil that seems to have tripped me up. Soil has this method in the NiceSearch class:

function redirect()
{
    global $wp_rewrite;
    if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->get_search_permastruct()) {
        return;
    }

    $search_base = $wp_rewrite->search_base;
    if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false && strpos($_SERVER['REQUEST_URI'], '&') === false) {
        wp_redirect(get_search_link());
        exit();
    }
}
add_action('template_redirect', __NAMESPACE__ . '\\redirect');

I’m not sure why, but this method does not like empty queries. Adding:

    if (get_search_query() === '') {
        return;
    }

allows me to render a search page at \s?= but it would be nicer to render an empty page at \search. Any ideas?