moving searchbar to homepage
This commit is contained in:
1 parent
e10bd1c82a
commit
3846811164
4 files changed
+134
-35
No files matched your search
+85
-1
@@ -446,7 +446,91 @@ img.nav-svg-icon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================
|
/* ========================================
|
||||||
POST CARDS (home listing)
|
HOME SEARCH (relocated under the hero)
|
||||||
|
======================================== */
|
||||||
|
.home-search {
|
||||||
|
max-width: 720px;
|
||||||
|
margin: 0 auto var(--space-xl);
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-search .plugin {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the "Search" label — Popeye-style bare search bar */
|
||||||
|
.home-search .plugin-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-search .plugin-content,
|
||||||
|
.home-search form {
|
||||||
|
display: flex;
|
||||||
|
gap: var(--space-sm);
|
||||||
|
align-items: stretch;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-search .form-control {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-search button {
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 575.98px) {
|
||||||
|
.home-search .plugin-content,
|
||||||
|
.home-search form {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
POST LIST (titles only)
|
||||||
|
======================================== */
|
||||||
|
.post-list-item {
|
||||||
|
padding: var(--space-md) 0;
|
||||||
|
border-bottom: 1px solid var(--border-subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-list-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-list-head {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: var(--space-md);
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-list-title {
|
||||||
|
font-size: 1.3rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text-primary);
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-list-head a:hover .post-list-title {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-list-date {
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================================
|
||||||
|
POST CARDS (single page / post)
|
||||||
======================================== */
|
======================================== */
|
||||||
.card-modern {
|
.card-modern {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|||||||
@@ -11,6 +11,28 @@
|
|||||||
<!-- Navbar -->
|
<!-- Navbar -->
|
||||||
<?php include(THEME_DIR_PHP.'navbar.php'); ?>
|
<?php include(THEME_DIR_PHP.'navbar.php'); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Split the siteSidebar plugins into "search" and "everything else".
|
||||||
|
// This lets us relocate the search box under the hero on the homepage
|
||||||
|
// (Popeye-style) while keeping the other plugins in the right sidebar.
|
||||||
|
// Mirrors Bludit's own Theme::plugins() loop, but captures the output.
|
||||||
|
global $plugins;
|
||||||
|
$sidebarSearchHtml = '';
|
||||||
|
$sidebarOtherHtml = '';
|
||||||
|
if (isset($plugins['siteSidebar'])) {
|
||||||
|
foreach ($plugins['siteSidebar'] as $plugin) {
|
||||||
|
$out = $plugin->siteSidebar();
|
||||||
|
if (strpos($out, 'plugin-search') !== false) {
|
||||||
|
$sidebarSearchHtml .= $out;
|
||||||
|
} else {
|
||||||
|
$sidebarOtherHtml .= $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// The hero (and the relocated search) only appear on the blog front page.
|
||||||
|
$heroVisible = ($WHERE_AM_I === 'home' && Paginator::currentPage() == 1);
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
+17
-33
@@ -26,6 +26,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<!-- Search box, relocated from the sidebar (Popeye-style) -->
|
||||||
|
<?php if (!empty($sidebarSearchHtml)) : ?>
|
||||||
|
<div class="home-search">
|
||||||
|
<?php echo $sidebarSearchHtml; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (empty($content)) : ?>
|
<?php if (empty($content)) : ?>
|
||||||
@@ -34,47 +41,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php foreach ($content as $page) : ?>
|
<!-- Post list (titles only) -->
|
||||||
<!-- Post -->
|
<div class="post-list">
|
||||||
<article class="card card-modern my-5">
|
<?php foreach ($content as $page) : ?>
|
||||||
|
<article class="post-list-item">
|
||||||
|
|
||||||
<!-- Load Bludit Plugins: Page Begin -->
|
<!-- Load Bludit Plugins: Page Begin -->
|
||||||
<?php Theme::plugins('pageBegin'); ?>
|
<?php Theme::plugins('pageBegin'); ?>
|
||||||
|
|
||||||
<!-- Cover image -->
|
<div class="post-list-head">
|
||||||
<?php if ($page->coverImage()) : ?>
|
|
||||||
<a href="<?php echo $page->permalink(); ?>" class="cover-image-wrapper d-block">
|
|
||||||
<img class="card-img-top" alt="<?php echo $page->title(); ?>" src="<?php echo $page->coverImage(); ?>" />
|
|
||||||
</a>
|
|
||||||
<?php endif ?>
|
|
||||||
|
|
||||||
<div class="card-body">
|
|
||||||
<!-- Title -->
|
|
||||||
<a href="<?php echo $page->permalink(); ?>">
|
<a href="<?php echo $page->permalink(); ?>">
|
||||||
<h2 class="title"><?php echo $page->title(); ?></h2>
|
<h2 class="post-list-title"><?php echo $page->title(); ?></h2>
|
||||||
</a>
|
</a>
|
||||||
|
<span class="post-list-date"><?php echo $page->date(); ?></span>
|
||||||
<!-- Creation date and reading time -->
|
|
||||||
<div class="metadata mb-4">
|
|
||||||
<span><i class="bi bi-calendar3"></i><?php echo $page->date(); ?></span>
|
|
||||||
<span><i class="bi bi-clock-history"></i><?php echo $L->get('Reading time') . ': ' . $page->readingTime(); ?></span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Breaked content -->
|
|
||||||
<?php echo $page->contentBreak(); ?>
|
|
||||||
|
|
||||||
<!-- "Read more" button -->
|
|
||||||
<?php if ($page->readMore()) : ?>
|
|
||||||
<a class="btn-primary-gradient mt-3" href="<?php echo $page->permalink(); ?>">
|
|
||||||
<?php echo $L->get('Read more'); ?>
|
|
||||||
<i class="bi bi-arrow-right"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif ?>
|
|
||||||
|
|
||||||
<!-- Tags and Category -->
|
<!-- Tags and Category -->
|
||||||
<?php $tagsList = $page->tags(true); $categoryKey = $page->categoryKey(); ?>
|
<?php $tagsList = $page->tags(true); $categoryKey = $page->categoryKey(); ?>
|
||||||
<?php if (!empty($tagsList) || $categoryKey) : ?>
|
<?php if (!empty($tagsList) || $categoryKey) : ?>
|
||||||
<div class="post-taxonomy mt-4">
|
<div class="post-taxonomy mt-2">
|
||||||
<?php if ($categoryKey) : ?>
|
<?php if ($categoryKey) : ?>
|
||||||
<a class="taxonomy-badge" href="<?php echo $page->categoryPermalink(); ?>">
|
<a class="taxonomy-badge" href="<?php echo $page->categoryPermalink(); ?>">
|
||||||
<i class="bi bi-folder2"></i><?php echo $page->category(); ?>
|
<i class="bi bi-folder2"></i><?php echo $page->category(); ?>
|
||||||
@@ -86,13 +71,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Load Bludit Plugins: Page End -->
|
<!-- Load Bludit Plugins: Page End -->
|
||||||
<?php Theme::plugins('pageEnd'); ?>
|
<?php Theme::plugins('pageEnd'); ?>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
<?php if (Paginator::numberOfPages() > 1) : ?>
|
<?php if (Paginator::numberOfPages() > 1) : ?>
|
||||||
|
|||||||
+10
-1
@@ -17,5 +17,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php Theme::plugins('siteSidebar') ?>
|
<?php
|
||||||
|
// On the homepage front page the search box is shown under the hero,
|
||||||
|
// so only render the remaining sidebar plugins here. Everywhere else
|
||||||
|
// the sidebar shows the full set (search included).
|
||||||
|
if ($heroVisible) {
|
||||||
|
echo $sidebarOtherHtml;
|
||||||
|
} else {
|
||||||
|
echo $sidebarSearchHtml . $sidebarOtherHtml;
|
||||||
|
}
|
||||||
|
?>
|
||||||
</aside>
|
</aside>
|
||||||
Reference in new issue
Block a user