168 lines
7.2 KiB
PHP
168 lines
7.2 KiB
PHP
<?php
|
|
// ---- Profile hero (Blowfish-style) -------------------------------------
|
|
// Shown only on the blog front page (first paginated page).
|
|
// Drop your avatar at img/spleenftw.jpeg (change the filename below to reuse).
|
|
$profileImage = DOMAIN_THEME . 'img/spleenftw.jpeg';
|
|
$showProfile = ($WHERE_AM_I === 'home');
|
|
?>
|
|
<?php if ($showProfile) : ?>
|
|
<header class="profile text-center">
|
|
<img class="profile-avatar" src="<?php echo $profileImage; ?>" alt="<?php echo blowfish_text($site->title()); ?>" />
|
|
<h1 class="profile-name"><?php echo blowfish_text($site->title()); ?></h1>
|
|
<?php if ($site->slogan()) : ?>
|
|
<p class="profile-bio"><?php echo blowfish_text($site->slogan()); ?></p>
|
|
<?php elseif ($site->description()) : ?>
|
|
<p class="profile-bio"><?php echo blowfish_text($site->description()); ?></p>
|
|
<?php endif ?>
|
|
|
|
<?php $networks = Theme::socialNetworks(); ?>
|
|
<div class="profile-social">
|
|
<?php foreach ($networks as $key => $label) : ?>
|
|
<a href="<?php echo $site->{$key}(); ?>" target="_blank" rel="noopener" title="<?php echo blowfish_text($label) ?>">
|
|
<img class="profile-social-icon" src="<?php echo blowfish_asset('img/' . $key . '.svg') ?>" alt="<?php echo blowfish_text($label) ?>" />
|
|
</a>
|
|
<?php endforeach ?>
|
|
<!-- RSS feed (served by the RSS plugin at /rss.xml) -->
|
|
<a href="<?php echo rtrim(Theme::siteUrl(), '/') . '/rss.xml'; ?>" target="_blank" rel="noopener" title="<?php echo $L->get('RSS'); ?>">
|
|
<img class="profile-social-icon" src="<?php echo blowfish_asset('img/rss.svg') ?>" alt="<?php echo $L->get('RSS'); ?>" />
|
|
</a>
|
|
<!-- Email (mailto) -->
|
|
<?php if (!empty($blowfishEmail)) : ?>
|
|
<a href="mailto:<?php echo htmlspecialchars($blowfishEmail, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo $L->get('Email'); ?>">
|
|
<img class="profile-social-icon" src="<?php echo blowfish_asset('img/mail.svg') ?>" alt="<?php echo $L->get('Email'); ?>" />
|
|
</a>
|
|
<?php endif ?>
|
|
</div>
|
|
</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 if (empty($content)) : ?>
|
|
<div class="mt-5">
|
|
<?php $language->p('No pages found') ?>
|
|
</div>
|
|
<?php endif ?>
|
|
|
|
<!-- Post list (titles only) -->
|
|
<div class="post-list">
|
|
<?php foreach ($content as $page) : ?>
|
|
<article class="post-list-item">
|
|
|
|
<!-- Load Bludit Plugins: Page Begin -->
|
|
<?php Theme::plugins('pageBegin'); ?>
|
|
|
|
<div class="post-list-head">
|
|
<a href="<?php echo $page->permalink(); ?>">
|
|
<h2 class="post-list-title"><?php echo blowfish_text($page->title()); ?></h2>
|
|
</a>
|
|
<div class="post-list-meta">
|
|
<span><?php echo blowfish_icon('calendar'); ?><?php echo $page->date(); ?></span>
|
|
<?php if (!$page->isStatic()) : ?>
|
|
<span><?php echo blowfish_icon('clock'); ?><?php echo $page->readingTime(); ?></span>
|
|
<?php endif ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Excerpt (the page description, set in the admin's SEO tab) -->
|
|
<?php $bdExcerpt = blowfish_plain($page->description()); ?>
|
|
<?php if ($bdExcerpt !== '') : ?>
|
|
<p class="post-list-excerpt"><?php echo htmlspecialchars($bdExcerpt, ENT_QUOTES, 'UTF-8'); ?></p>
|
|
<?php endif ?>
|
|
|
|
<!-- Tags and Category — capped so the list stays scannable -->
|
|
<?php
|
|
$tagsList = $page->tags(true);
|
|
$categoryKey = $page->categoryKey();
|
|
$bdMaxTags = 5; // tags shown per post on the list; the rest collapse into "+N"
|
|
?>
|
|
<?php if (!empty($tagsList) || $categoryKey) : ?>
|
|
<div class="post-taxonomy">
|
|
<?php if ($categoryKey) : ?>
|
|
<a class="taxonomy-badge" href="<?php echo $page->categoryPermalink(); ?>">
|
|
<?php echo blowfish_icon('folder'); ?><?php echo blowfish_text($page->category()); ?>
|
|
</a>
|
|
<?php endif ?>
|
|
<?php $bdTagCount = 0; $bdTagOverflow = 0; ?>
|
|
<?php foreach ($tagsList as $tagKey => $tagName) : ?>
|
|
<?php if ($bdTagCount < $bdMaxTags) : $bdTagCount++; ?>
|
|
<a class="taxonomy-badge" href="<?php echo DOMAIN_TAGS . $tagKey; ?>"><?php echo blowfish_icon('tag'); ?><?php echo blowfish_text($tagName); ?></a>
|
|
<?php else : $bdTagOverflow++; ?>
|
|
<?php endif ?>
|
|
<?php endforeach ?>
|
|
<?php if ($bdTagOverflow > 0) : ?>
|
|
<a class="taxonomy-badge taxonomy-badge-more" href="<?php echo $page->permalink(); ?>" title="<?php echo $L->get('All tags'); ?>">+<?php echo $bdTagOverflow; ?></a>
|
|
<?php endif ?>
|
|
</div>
|
|
<?php endif ?>
|
|
|
|
<!-- Load Bludit Plugins: Page End -->
|
|
<?php Theme::plugins('pageEnd'); ?>
|
|
|
|
</article>
|
|
<?php endforeach ?>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<?php if (Paginator::numberOfPages() > 1) : ?>
|
|
<?php
|
|
$totalPages = Paginator::numberOfPages();
|
|
$currentPage = Paginator::currentPage();
|
|
|
|
// Derive a per-page URL template by borrowing Bludit's own next/prev URL
|
|
// (always of the form ...?page=N) and turning the number into a token. Use
|
|
// a page >= 2 as the source so the "page=N" token is always present.
|
|
$pageTemplate = null;
|
|
if (Paginator::showNext()) {
|
|
$pageTemplate = str_replace('page=' . ($currentPage + 1), 'page={N}', Paginator::nextPageUrl());
|
|
} elseif (Paginator::showPrev() && ($currentPage - 1) >= 2) {
|
|
$pageTemplate = str_replace('page=' . ($currentPage - 1), 'page={N}', Paginator::previousPageUrl());
|
|
}
|
|
// Adjacent pages use Bludit's exact URLs; non-adjacent use the template.
|
|
$pageUrl = function ($n) use ($currentPage, $pageTemplate) {
|
|
if ($n == $currentPage - 1) { return Paginator::previousPageUrl(); }
|
|
if ($n == $currentPage + 1) { return Paginator::nextPageUrl(); }
|
|
return $pageTemplate ? str_replace('{N}', $n, $pageTemplate) : '#';
|
|
};
|
|
?>
|
|
<nav class="paginator mt-5" aria-label="<?php echo $L->get('Pagination'); ?>">
|
|
<ul class="pagination flex-wrap justify-content-center">
|
|
|
|
<!-- Previous -->
|
|
<?php if (Paginator::showPrev()) : ?>
|
|
<li class="page-item">
|
|
<a class="page-link is-arrow" href="<?php echo Paginator::previousPageUrl() ?>" aria-label="<?php echo $L->get('Previous'); ?>">
|
|
<?php echo blowfish_icon('chevron-left'); ?>
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
<!-- Numbered pages -->
|
|
<?php for ($i = 1; $i <= $totalPages; $i++) : ?>
|
|
<li class="page-item<?php echo ($i == $currentPage) ? ' active' : ''; ?>">
|
|
<?php if ($i == $currentPage) : ?>
|
|
<span class="page-link" aria-current="page"><?php echo $i; ?></span>
|
|
<?php else : ?>
|
|
<a class="page-link" href="<?php echo $pageUrl($i); ?>"><?php echo $i; ?></a>
|
|
<?php endif; ?>
|
|
</li>
|
|
<?php endfor; ?>
|
|
|
|
<!-- Next -->
|
|
<?php if (Paginator::showNext()) : ?>
|
|
<li class="page-item">
|
|
<a class="page-link is-arrow" href="<?php echo Paginator::nextPageUrl() ?>" aria-label="<?php echo $L->get('Next'); ?>">
|
|
<?php echo blowfish_icon('chevron-right'); ?>
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
</ul>
|
|
</nav>
|
|
<?php endif ?>
|