Skip to content

Commit

Permalink
append subtitle to title if hit has content
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkruss committed Jul 30, 2018
1 parent f4bdd9e commit 173165d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions laravel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit 173165d

Please sign in to comment.