add active page, color to archives

This commit is contained in:
2025-06-12 09:49:22 -07:00
parent d22a57f378
commit 96f0f90224
4 changed files with 21 additions and 4 deletions

View File

@ -991,7 +991,7 @@ table.alt tfoot {
/* Panel */
.panel {
padding: 4em 4em 2em 4em;
padding: 4em 4em 4em 4em;
transform: translateY(100vh);
transition: transform 0.5s ease;
-webkit-overflow-scrolling: touch;
@ -1650,4 +1650,8 @@ body.is-preload #main .thumb {
#footer p.copyright a {
color: inherit;
}
a.active-year {
color: #ff629e;
}

File diff suppressed because one or more lines are too long

View File

@ -1127,7 +1127,7 @@ table.alt tfoot {
/* Panel */
.panel {
padding: 4em 4em 2em 4em;
padding: 4em 4em 4em 4em;
-moz-transform: translateY(100vh);
-webkit-transform: translateY(100vh);
-ms-transform: translateY(100vh);
@ -2061,4 +2061,7 @@ body.is-preload #main .thumb {
#footer p.copyright a {
color: inherit;
}
a.active-year{
color: #ff629e;
}

View File

@ -15,6 +15,15 @@ if (is_dir($archivesPath)) {
}
rsort($years, SORT_NUMERIC);
}
$currentYear = null;
$requestUri = $_SERVER['REQUEST_URI'];
if (preg_match('#^/archives/(\d{4})/#', $requestUri, $matches)) {
$currentYear = $matches[1];
} elseif (basename($_SERVER['SCRIPT_NAME']) === 'index.php') {
$currentYear = date('Y');
}
?>
<footer id="footer" class="panel">
@ -45,7 +54,8 @@ if (is_dir($archivesPath)) {
<section>
<h2>Archives</h2>
<?php foreach ($years as $year): ?>
<h2><a href="/archives/<?= $year ?>/"><?= $year ?></a></h2>
<?php $class = ($year == $currentYear) ? ' class="active-year"' : ''; ?>
<h2><a href="/archives/<?= $year ?>/"<?= $class ?>><?= $year ?></a></h2>
<?php endforeach; ?>
</section>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/inc/base/copyright.php'; ?>