♻️ Refactor the popeye theme as a bootstrap basic theme

This commit is contained in:
Kazhnuz 2025-07-27 15:59:46 +02:00
parent 70b64f7c90
commit 90f139413e
24 changed files with 127 additions and 396 deletions

View file

@ -0,0 +1,4 @@
.site-logo {
max-width: 100%;
height: auto;
}

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View file

@ -27,29 +27,13 @@
'css/01-style.css',
'css/02-helpers.css'
));
# Apply the following CSS only for Dark Mode
if ($themePlugin->darkMode()) {
echo Theme::css(
'css/99-darkmode.css'
);
}
?>
<?php if ($themePlugin->googleFonts()) : ?>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:sans,bold">
<style>
body {
font-family: "Open Sans", sans-serif;
}
</style>
<?php endif; ?>
<!-- Execute Koblog plugins for the hook "Site head" -->
<?php Theme::plugins('siteHead'); ?>
</head>
<body>
<body class="bg-body-tertiary">
<!-- Execute Koblog plugins for the hook "Site body begin" -->
<?php Theme::plugins('siteBodyBegin'); ?>
@ -82,6 +66,16 @@
<!-- Execute Koblog plugins for the hook "Site body end" -->
<?php Theme::plugins('siteBodyEnd'); ?>
<script>
window.addEventListener('scroll',(e)=>{
const nav = document.querySelector('.navbar');
if(window.pageYOffset>0){
nav.classList.add("shadow-sm");
}else{
nav.classList.remove("shadow-sm");
}
});
</script>
</body>
</html>

View file

@ -1,8 +1,8 @@
{
"theme-data":
{
"name": "Popeye",
"description": ""
"name": "Bootstrap",
"description": "A simple bootstrap-based theme"
},
"related-pages": "Verwandte Seiten",
"minutes": "Minuten",

View file

@ -1,8 +1,8 @@
{
"theme-data":
{
"name": "Popeye",
"description": ""
"name": "Bootstrap",
"description": "A simple bootstrap-based theme"
},
"related-pages": "Verwandte Seiten",
"minutes": "Minuten",

View file

@ -1,8 +1,8 @@
{
"theme-data":
{
"name": "Popeye",
"description": ""
"name": "Bootstrap",
"description": "A simple bootstrap-based theme"
},
"related-pages": "Verwandte Seiten",
"minutes": "Minuten",

View file

@ -1,8 +1,8 @@
{
"theme-data":
{
"name": "Popeye",
"description": ""
"name": "Bootstrap",
"description": "A simple bootstrap-based theme"
},
"related-pages": "Related pages",
"minutes": "minutes",

View file

@ -1,8 +1,8 @@
{
"theme-data":
{
"name": "Popeye",
"description": ""
"name": "Bootstrap",
"description": "A simple bootstrap-based theme"
},
"related-pages": "関連ページ",
"minutes": "分",

View file

@ -0,0 +1,8 @@
<footer class="footer p-3 p-md-5 mt-5 text-center">
<div class="container">
<p class="m-0 mt-2">
<?php echo $site->footer(); ?> -
<span><?php echo $L->get('Powered by'); ?> <a target="_blank" href="https://git.kobold.cafe/kazhnuz/koblog">KOBLOG</a></span>
</p>
</div>
</footer>

View file

@ -1,20 +1,30 @@
<header class="p-3">
<div class="container text-center">
<div class="container mt-4">
<!-- Site logo -->
<?php if ($site->logo()) : ?>
<div class="site-logo">
<img class="img-thumbnail rounded-circle mx-auto d-block" height="140px" width="140px" src="<?php echo ($site->logo() ? $site->logo() : HTML_PATH_THEME_IMG . 'popeye.png') ?>" alt="">
<img class="mx-auto d-block" src="<?php $site->logo() ?>" alt="">
</div>
<?php endif ?>
<!-- End Site logo -->
<!-- Site description -->
<?php if ($site->description()) : ?>
<div class="site-description mt-2">
<p><?php echo $site->description(); ?></p>
<div class="site-description mt-2 text-center font-bold">
<p><strong><?php echo $site->description(); ?></strong></p>
</div>
<?php endif ?>
<!-- End Site description -->
<!-- Site homepage presentation -->
<?php if ($site->homepagePresentation() && ($WHERE_AM_I == 'home')) : ?>
<div class="site-description mt-2 col-lg-8 mx-auto">
<p><?php echo Theme::getHomepagePresentation(); ?></p>
</div>
<?php endif ?>
<!-- End Site homepage presentation -->
</div>
</header>
@ -23,30 +33,6 @@
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto">
<!-- Search input -->
<?php if (pluginActivated('pluginSearch')) : ?>
<form class="d-flex mb-4">
<input id="search-input" class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-primary" type="button" onClick="searchNow()">Search</button>
</form>
<script>
function searchNow() {
var searchURL = "<?php echo Theme::siteUrl(); ?>search/";
window.open(searchURL + document.getElementById("search-input").value, "_self");
}
document.getElementById("search-input").onkeypress = function(e) {
if (!e) e = window.event;
var keyCode = e.keyCode || e.which;
if (keyCode == '13') {
searchNow();
return false;
}
}
</script>
<?php endif ?>
<!-- End Search input -->
<?php if (Theme::locationTitle()): ?>
<h2><?php echo Theme::locationTitle(); ?></h2>
<?php endif; ?>
@ -60,7 +46,7 @@
<!-- End Content not available -->
<!-- Pages -->
<div class="list-group list-group-flush">
<div class="list-group">
<?php foreach ($content as $pageTmp) : ?>
<div class="list-group-item pt-4 pb-4" aria-current="true">
<div class="d-flex w-100 justify-content-between">
@ -106,11 +92,9 @@
if ($themePlugin->showTags()) {
$tagsList = $pageTmp->tags(true);
if (!empty($tagsList)) {
echo '<small>';
foreach ($tagsList as $tagKey => $tagName) {
echo '<a class="badge bg-gray text-dark text-decoration-none me-2" href="' . DOMAIN_TAGS . $tagKey . '">' . $tagName . '</a>';
echo '<a class="badge btn btn-primary rounded-pill me-2" href="' . DOMAIN_TAGS . $tagKey . '">' . $tagName . '</a>';
}
echo '</small>';
}
}
?>
@ -122,29 +106,9 @@
<!-- End Pages -->
<!-- Pagination -->
<?php if (Paginator::numberOfPages() > 1) : ?>
<nav class="mt-4">
<ul class="pagination pagination-sm">
<!-- Older pages -->
<?php if (Paginator::showNext()) : ?>
<li class="page-item">
<a class="page-link" href="<?php echo Paginator::nextPageUrl() ?>">&#9664; <?php echo $L->get('Previous'); ?></a>
</li>
<?php endif; ?>
<!-- End Older pages -->
<!-- Newer pages -->
<?php if (Paginator::showPrev()) : ?>
<li class="page-item ms-auto">
<a class="page-link" href="<?php echo Paginator::previousPageUrl() ?>" tabindex="-1"><?php echo $L->get('Next'); ?> &#9658;</a>
</li>
<?php endif; ?>
<!-- End Newer pages -->
</ul>
</nav>
<?php endif ?>
<div class="mt-2">
<?php echo Paginator::bootstrap_numberedPageHTML("justify-content-end"); ?>
</div>
<!-- End Pagination -->
</div>

View file

@ -0,0 +1,34 @@
<nav class="navbar navbar-expand-lg bg-body-tertiary sticky-top">
<div class="container">
<a class="navbar-brand bold" href="<?php echo $site->url() ?>"><?php echo $site->title() ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" href="<?php echo $site->url() ?>"><?php echo $L->get("Home"); ?></a>
</li>
</ul>
<ul class="navbar-nav">
<!-- Static pages -->
<?php foreach ($staticContent as $tmp) : ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $tmp->permalink(); ?>"><?php echo $tmp->title(); ?></a>
</li>
<?php endforeach ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?php echo $L->get("Social Networks"); ?>
</a>
<ul class="dropdown-menu">
<?php foreach (Theme::socialNetworks() as $key => $name) {
echo '<li><a class="dropdown-item" href="' . $site->getSocialNetwork($name) . '">' . $name . '</a></li>';
}
?>
</ul>
</li>
</ul>
</div>
</div>
</nav>

View file

@ -0,0 +1,40 @@
<section class="page mt-4 mb-4">
<div class="container">
<div class="row">
<div class="col-lg-6 mx-auto">
<!-- Load Koblog Plugins: Page Begin -->
<?php Theme::plugins('pageBegin'); ?>
<?php if (!$page->isStatic() && !$url->notFound()) : ?>
<div class="form-text mb-2">
<!-- Page creation time -->
<span class="pe-3"><i class="bi bi-calendar me-1"></i><?php echo $page->date() ?></span>
<!-- Page reading time -->
<span class="pe-3"><i class="bi bi-clock me-1"></i><?php echo $page->readingTime() . ' ' . $L->get('minutes') . ' ' . $L->g('read') ?></span>
<!-- Page author -->
<span><a href="<?php echo $page->user('authorUri'); ?>"><i class="bi bi-person me-1"></i><?php echo $page->user('displayName') ?></a></span>
</div>
<?php endif ?>
<!-- Page title -->
<h1 class="page-title bold"><?php echo $page->title(); ?></h1>
<!-- Page description -->
<?php if ($page->description()) : ?>
<p class="page-description italic mt-1 color-light"><?php echo $page->description(); ?></p>
<hr />
<?php endif ?>
<!-- Page content -->
<div class="page-content mt-3">
<?php echo $page->content(); ?>
</div>
<!-- Load Koblog Plugins: Page End -->
<?php Theme::plugins('pageEnd'); ?>
</div>
</div>
</div>
</section>

View file

@ -6,8 +6,6 @@ class popeye extends Plugin
public function init()
{
$this->dbFields = array(
'googleFonts' => true,
'darkMode' => true,
'dateFormat' => 'relative',
'showTags' => true
);
@ -17,24 +15,6 @@ class popeye extends Plugin
{
global $L;
$html = '<div class="mb-3">';
$html .= '<label class="form-label" for="darkMode">' . $L->get('Dark Mode') . '</label>';
$html .= '<select class="form-select" id="darkMode" name="darkMode">';
$html .= '<option value="true" ' . ($this->getValue('darkMode') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('darkMode') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '<div class="form-text">' . $L->get('Enable or disable dark mode.') . '</div>';
$html .= '</div>';
$html .= '<div class="mb-3">';
$html .= '<label class="form-label" for="googleFonts">' . $L->get('Google Fonts') . '</label>';
$html .= '<select class="form-select" id="googleFonts" name="googleFonts">';
$html .= '<option value="true" ' . ($this->getValue('googleFonts') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
$html .= '<option value="false" ' . ($this->getValue('googleFonts') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
$html .= '</select>';
$html .= '<div class="form-text">' . $L->get('Enable or disable Google fonts.') . '</div>';
$html .= '</div>';
$html .= '<div class="mb-3">';
$html .= '<label class="form-label" for="dateFormat">' . $L->get('Date format') . '</label>';
$html .= '<select class="form-select" id="dateFormat" name="dateFormat">';
@ -56,16 +36,6 @@ class popeye extends Plugin
return $html;
}
public function darkMode()
{
return $this->getValue('darkMode');
}
public function googleFonts()
{
return $this->getValue('googleFonts');
}
public function dateFormat()
{
return $this->getValue('dateFormat');

View file

@ -1,6 +1,6 @@
<footer id="main-footer">
<p class="m-0 text-center text-white text-uppercase">
<?php echo $site->footer(); ?> -
<span><?php echo $L->get('Powered by'); ?> <a target="_blank" class="text-white" href="https://git.kobold.cafe/kazhnuz/koblog">KOBLOG</a></span>
<span><?php echo $L->get('Powered by'); ?> <a target="_blank" href="https://git.kobold.cafe/kazhnuz/koblog">KOBLOG</a></span>
</p>
</footer>

View file

@ -1,113 +0,0 @@
/* COMMON */
a {
color: #495057;
text-decoration: none;
}
a:hover {
color: #0a58ca;
}
img {
max-width: 100%;
}
pre, code {
color: #f8f8f8;
background-color: #495057;
}
code {
display: inline-block;
padding: 0 0.5em;
line-height: 1.4em;
border-radius: 3px;
}
pre {
overflow-x: scroll;
padding: 1.6rem 2.2rem;
line-height: 1.5;
border-radius: 5px !important;
}
/* BOOTSTRAP */
.list-group-item {
background-color: inherit;
}
.badge {
font-size: 0.8rem;
font-weight: 400;
}
.bi {
margin-right: .5rem!important;
}
.btn:focus,
.form-control:focus,
.form-select:focus {
outline: none !important;
box-shadow: none !important;
}
/* PAGE */
section.page {
font-size: 1.1rem;
}
section.page .description {
font-style: italic;
}
section.page a {
color: #0a58ca;
}
section.page p {
margin-bottom: 1.2rem;
}
section.page h1.page-title {
font-size: 2rem;
}
section.page h2 {
font-size: 1.5rem;
}
section.page h3 {
font-size: 1.3rem;
}
section.page h4 {
font-size: 1.1rem;
}
section.page h5 {
font-size: 1rem;
}
section.page h2,
section.page h3,
section.page h4,
section.page h5 {
margin: 2rem 0 1rem 0;
}
/* VIDEO EMBED RESPONSIVE */
.video-embed {
overflow:hidden;
padding-bottom: 56.25%; /* 16:9 */
position:relative;
height:0;
}
.video-embed iframe{
left:0;
top:0;
height:100%;
width:100%;
position:absolute;
}

View file

@ -1,20 +0,0 @@
/* HELPERs */
.color-blue {
color: #0a58ca;
}
.color-light {
color: #495057;
}
.bold {
font-weight: 600;
}
.italic {
font-style: italic;
}
.bg-gray {
background-color: #ececec;
}

View file

@ -1,50 +0,0 @@
body {
background-color: #1C1C1E !important;
color: #b3b3b3 !important;
}
a {
color: #b3b3b3 !important;
}
a:hover {
color: #e2e2e2 !important
}
a.badge:hover {
color: #999 !important;
}
.form-text {
color: #989899 !important;
}
.bg-light {
background-color: #000 !important;
}
.color-blue {
color: #688bbd !important;
}
.btn-outline-primary {
color: #688bbd !important;
border-color: #688bbd !important;
}
.btn-outline-primary:hover {
background-color: #1C1C1E !important;
color: #fff !important;
}
.page-link {
color: #688bbd !important;
border-color: #688bbd !important;
background-color: #1C1C1E !important;
}
.form-control {
background-color: #1C1C1E !important;
border-color: #302F33 !important;
color: #b3b3b3 !important;
}

View file

@ -1,11 +0,0 @@
<footer class="footer p-3 p-md-5 mt-5 text-center">
<div class="container">
<ul class="footer-links pl-0 mb-1">
<?php foreach (Theme::socialNetworks() as $key => $name) {
echo '<a class="color-blue" href="' . $site->getSocialNetwork($name) . '"><li class="d-inline-block pr-4">' . $name . '</li></a>';
}
?>
</ul>
<p class="m-0 mt-2">Powered by <a class="color-blue" href="https://git.kobold.cafe/kazhnuz/koblog">Koblog</a> - Open source CMS</p>
</div>
</footer>

View file

@ -1,11 +0,0 @@
<nav class="navbar navbar-light bg-light sticky-top">
<div class="container">
<a class="navbar-brand bold" href="<?php echo $site->url() ?>"><?php echo $site->title() ?></a>
<div class="d-flex">
<!-- Static pages -->
<?php foreach ($staticContent as $tmp) : ?>
<a class="me-3 ms-3" href="<?php echo $tmp->permalink(); ?>"><?php echo $tmp->title(); ?></a>
<?php endforeach ?>
</div>
</div>
</nav>

View file

@ -1,78 +0,0 @@
<section class="page mt-4 mb-4">
<div class="container">
<div class="row">
<div class="col-lg-6 mx-auto">
<!-- Load Koblog Plugins: Page Begin -->
<?php Theme::plugins('pageBegin'); ?>
<?php if (!$page->isStatic() && !$url->notFound()) : ?>
<div class="form-text mb-2">
<!-- Page creation time -->
<span class="pe-3"><i class="bi bi-calendar"></i><?php echo $page->date() ?></span>
<!-- Page reading time -->
<span class="pe-3"><i class="bi bi-clock"></i><?php echo $page->readingTime() . ' ' . $L->get('minutes') . ' ' . $L->g('read') ?></span>
<!-- Page author -->
<span><a href="<?php echo $page->user('authorUri'); ?>"><i class="bi bi-person"></i><?php echo $page->user('displayName') ?></a></span>
</div>
<?php endif ?>
<!-- Page title -->
<h1 class="page-title bold"><?php echo $page->title(); ?></h1>
<!-- Page description -->
<?php if ($page->description()) : ?>
<p class="page-description italic mt-1 color-light"><?php echo $page->description(); ?></p>
<?php endif ?>
<!-- Page content -->
<div class="page-content mt-3">
<?php echo $page->content(); ?>
</div>
<!-- Load Koblog Plugins: Page End -->
<?php Theme::plugins('pageEnd'); ?>
</div>
</div>
</div>
</section>
<!-- Related pages -->
<?php
$relatedPages = $page->related(true, 3);
?>
<?php if (!empty($relatedPages)) : ?>
<section class="related mt-4 mb-4">
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto p-4 bg-light">
<h4><?php $L->p('Related pages') ?></h4>
<div class="list-group list-group-flush">
<?php foreach ($relatedPages as $pageKey) : ?>
<?php $tmp = new Page($pageKey); ?>
<div class="list-group-item pt-4 pb-4" aria-current="true">
<div class="d-flex w-100 justify-content-between">
<!-- Related page title -->
<a href="<?php echo $tmp->permalink() ?>">
<h5 class="mb-1"><?php echo $tmp->title() ?></h5>
</a>
<!-- Related page date -->
<small class="color-blue"><?php echo $tmp->relativeTime() ?></small>
</div>
<!-- Related page description -->
<?php if ($tmp->description()) : ?>
<p class="mb-1 form-text"><?php echo $tmp->description(); ?></p>
<?php endif ?>
</div>
<?php endforeach ?>
</div>
</div>
</div>
</div>
</section>
<?php endif; ?>