From 173165d7b89ef342e9bc7d7d24e5461d10ddd242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kru=CC=88ss?= Date: Mon, 30 Jul 2018 12:59:34 -0700 Subject: [PATCH] append subtitle to title if hit has content --- laravel.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/laravel.php b/laravel.php index 76652d9..2b18570 100644 --- a/laravel.php +++ b/laravel.php @@ -40,9 +40,12 @@ $title = $hit['h1']; $subtitle = $hasSubtitle ? $hit['h2'] : null; - if ($hasSubtitle && $hasText) { - $title = $hit['h2']; + if ($hasText) { $subtitle = $hit['_highlightResult']['content']['value']; + + if ($hasSubtitle) { + $title = "{$title} ยป {$hit['h2']}"; + } } $title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));