'#ffffff',
'dark' => '#171717',
'nord' => '#2e3440',
'dracula' => '#282a36',
'catppuccin' => '#1e1e2e',
);
$blowditTheme = (isset($_COOKIE['blowdit-theme']) && isset($blowditThemeBg[$_COOKIE['blowdit-theme']]))
? $_COOKIE['blowdit-theme']
: 'light';
$blowditBg = $blowditThemeBg[$blowditTheme];
$blowditScheme = ($blowditTheme === 'light') ? 'light' : 'dark';
?>
siteSidebar();
$isSearch = (strpos($out, 'plugin-search') !== false);
$isNav = (strpos($out, 'plugin-navigation') !== false || strpos($out, 'plugin-pages') !== false);
// Fixed sidebar order (lower = higher up). Unknown plugins such as
// the Hit Counter default to 90, i.e. pinned to the bottom.
$priority = 90;
if (strpos($out, 'plugin-about') !== false) $priority = 10; // Blog / About
elseif ($isSearch) $priority = 20; // Search
elseif ($isNav) $priority = 30; // Navigation
elseif (strpos($out, 'plugin-categories') !== false) $priority = 40; // Category
if ($isSearch) {
$sidebarSearchHtml .= $out;
}
// Mark the navigation / pages plugin so its list can be shuffled
// client-side (see the script near the body end).
if ($isNav) {
$out = '' . $out . '
';
}
$sidebarItems[] = array(
'priority' => $priority,
'index' => $sidebarIndex++,
'search' => $isSearch,
'nav' => $isNav,
'html' => $out,
);
}
}
// Stable sort by priority, then original order (PHP < 8 usort isn't stable).
usort($sidebarItems, function ($a, $b) {
if ($a['priority'] === $b['priority']) {
return $a['index'] - $b['index'];
}
return $a['priority'] - $b['priority'];
});
$sidebarFullHtml = ''; // all plugins, ordered (used on article/page views)
$sidebarNoSearchHtml = ''; // same, minus search (kept for potential future use)
$sidebarHomeHtml = ''; // about + categories + hit counter only (homepage, no nav/search)
foreach ($sidebarItems as $item) {
$sidebarFullHtml .= $item['html'];
if (!$item['search']) {
$sidebarNoSearchHtml .= $item['html'];
}
if (!$item['search'] && !$item['nav']) {
$sidebarHomeHtml .= $item['html'];
}
}
// The hero (and the relocated search) only appear on the blog front page.
$heroVisible = ($WHERE_AM_I === 'home' && Paginator::currentPage() == 1);
// True when viewing a single non-static article.
$isArticlePage = ($WHERE_AM_I === 'page' && isset($page) && !$page->isStatic() && !$url->notFound());
// Show 3-column layout (left ToC + content + right sidebar) only when the article has headings.
$hasHeadings = $isArticlePage && (bool) preg_match('/content());
?>