diff --git a/themes/bootstrap5/templates/search/results.phtml b/themes/bootstrap5/templates/search/results.phtml index d1c16e65e1e..2e8baf59209 100644 --- a/themes/bootstrap5/templates/search/results.phtml +++ b/themes/bootstrap5/templates/search/results.phtml @@ -1,11 +1,9 @@ results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery(); - $headTitle = $this->slot('head-title') - ->get($this->translate('Search Results') . (empty($lookfor) ? '' : " - {$lookfor}")); - $this->headTitle($headTitle); + // Normally we would assign the title to its slot and set $this->headTitle here + // Instead we will do so at the end of the file so we can capture errors and no result messages // Set up search box: + $lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery(); $this->layout()->searchbox = $this->context($this)->renderInContext( 'search/searchbox.phtml', [ @@ -23,7 +21,8 @@ ); // Set up breadcrumbs: - $this->breadcrumbs()->add($headTitle, active: true); + $breadcrumb = $this->translate('Search Results') . (empty($lookfor) ? '' : " - {$lookfor}"); + $this->breadcrumbs()->add($breadcrumb, active: true); // Set up search controls (avoiding unnecessary rendering): if (!$this->slot('search-controls')->isset()) { @@ -50,7 +49,7 @@ $this->assetManager()->appendScriptString('var multiFacetsSelection = "' . $this->multiFacetsSelection . '";'); ?> -