- Fixed the cross-theme blank search issue in [plugin.php](/Users/tyemeclifford/Documents/GH/blog/bl-plugins/search/plugin.php).

The important change: search still intercepts the route early, but 
before themes render it now feeds results through the normal 
home/listing state. That avoids themes going blank when they do not know 
how to render a custom search state.
I also made search safer:
Indexes raw page text instead of fully rendered content.
Uses raw content for excerpts.
Guards the search call so exceptions do not white-screen the page.
Updated Dark Neon so it still detects search pages correctly after this 
compatibility change.
This commit is contained in:
Ty Clifford
2026-07-03 09:34:49 -04:00
parent 9d9790976a
commit d149a0bf8f
3 changed files with 22 additions and 9 deletions
+5 -4
View File
@@ -1,5 +1,6 @@
<?php
$searchPlugin = pluginActivated('pluginSearch') ? getPlugin('pluginSearch') : false;
$isSearchPage = $searchPlugin && $searchPlugin->getSearchTerm() !== '';
$sidebarHtml = '';
ob_start();
Theme::plugins('siteSidebar');
@@ -19,7 +20,7 @@ $socialIconMap = array(
);
?>
<?php if ($WHERE_AM_I !== 'search') : ?>
<?php if (!$isSearchPage) : ?>
<section class="neon-hero">
<div class="container">
<div class="hero-panel">
@@ -82,7 +83,7 @@ $socialIconMap = array(
<a href="<?php echo $page->permalink(); ?>"><?php echo htmlspecialchars($page->title(), ENT_QUOTES, 'UTF-8'); ?></a>
</h2>
<?php if ($page->description() && $WHERE_AM_I !== 'search') : ?>
<?php if ($page->description() && !$isSearchPage) : ?>
<p class="post-description"><?php echo htmlspecialchars($page->description(), ENT_QUOTES, 'UTF-8'); ?></p>
<?php endif; ?>
@@ -99,9 +100,9 @@ $socialIconMap = array(
</div>
<?php endif; ?>
<?php if ($page->readMore() || $WHERE_AM_I === 'search') : ?>
<?php if ($page->readMore() || $isSearchPage) : ?>
<a class="read-link" href="<?php echo $page->permalink(); ?>">
<span><?php echo ($WHERE_AM_I === 'search') ? $L->get('Open result') : $L->get('Read more'); ?></span>
<span><?php echo $isSearchPage ? $L->get('Open result') : $L->get('Read more'); ?></span>
<i class="bi bi-arrow-right" aria-hidden="true"></i>
</a>
<?php endif; ?>