Update default styles and templates

Remove hero section styles
Add CSS reset and variables
Improve typography and layout
Update base template with CSS versioning
Restructure list templates with semantic HTML
Add proper container classes
Improve code organization and readability
This commit is contained in:
Ruben 2026-02-10 22:25:44 +01:00
parent ca6d87b885
commit fde5cc4d0e
7 changed files with 171 additions and 345 deletions

View file

@ -1,3 +1,14 @@
<?php
$customCssPath = dirname(__DIR__, 2) . '/custom/styles/base.css';
$defaultCssPath = __DIR__ . '/../styles/styles.css';
if (file_exists($customCssPath)) {
$cssUrl = '/app/styles/base.css';
$cssHash = hash_file('md5', $customCssPath);
} else {
$cssUrl = '/app/default-styles/styles.css';
$cssHash = hash_file('md5', $defaultCssPath);
}
?>
<!DOCTYPE html>
<html lang="<?= htmlspecialchars($currentLang ?? 'en') ?>">
<head>
@ -10,7 +21,7 @@
<?php if (!empty($socialImageUrl)): ?>
<meta property="og:image" content="<?= htmlspecialchars($socialImageUrl) ?>">
<?php endif; ?>
<link rel="stylesheet" href="/app/default/styles/styles.css">
<link rel="stylesheet" href="<?= $cssUrl ?>?v=<?= $cssHash ?>">
<?php if (!empty($pageCssUrl)): ?>
<link rel="stylesheet" href="<?= htmlspecialchars($pageCssUrl) ?>?v=<?= htmlspecialchars($pageCssHash ?? '') ?>">
<?php endif; ?>
@ -19,41 +30,34 @@
<?php endif; ?>
</head>
<body>
<header>
<nav>
<a href="<?= htmlspecialchars($langPrefix ?? '') ?>/"><?= htmlspecialchars($homeLabel ?? ($translations['home'] ?? 'Home')) ?></a>
<?php if (!empty($navigation)): ?>
<?php foreach ($navigation as $item): ?>
<header class="contain">
<div>
<nav>
<a href="<?= htmlspecialchars($langPrefix ?? '') ?>/"><?= htmlspecialchars($translations['home'] ?? $homeLabel ?? 'Home') ?></a>
<?php if (!empty($navigation)): ?>
<?php foreach ($navigation as $item): ?>
<a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?></a>
<?php endforeach; ?>
<?php endif; ?>
</nav>
<?php if (!empty($languageUrls) && count($languageUrls) > 1): ?>
<nav class="language-switcher" aria-label="Language">
<?php foreach ($languageUrls as $lang => $url): ?>
<a href="<?= htmlspecialchars($url) ?>" <?= ($lang === $currentLang) ? 'aria-current="true"' : '' ?>><?= htmlspecialchars(strtoupper($lang)) ?></a>
<?php endforeach; ?>
</nav>
<?php endif; ?>
</nav>
<?php if (!empty($languageUrls) && count($languageUrls) > 1): ?>
<nav class="language-switcher" aria-label="Language">
<?php foreach ($languageUrls as $lang => $url): ?>
<a href="<?= htmlspecialchars($url) ?>" <?= ($lang === $currentLang) ? 'aria-current="true"' : '' ?>><?= htmlspecialchars(strtoupper($lang)) ?></a>
<?php endforeach; ?>
</nav>
<?php endif; ?>
</div>
</header>
<main>
<?= $content ?>
<?= $wrappedContent ?? $content ?>
</main>
<footer>
<nav>
<a href="https://mastodon.social/@example" rel="me">Mastodon</a>
<a href="https://bsky.app/profile/example.bsky.social">Bluesky</a>
</nav>
<p>
<?php if (!empty($translations['footer_handcoded'])): ?>
<?= htmlspecialchars($translations['footer_handcoded']) ?> <?= number_format((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2) ?><?= htmlspecialchars($translations['footer_page_time'] ?? 'ms') ?>
<?php else: ?>
Generated in <?= number_format((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2) ?>ms
<?php endif; ?>
</p>
<footer class="contain">
<p>Generated in <?= number_format((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2) ?>ms</p>
</footer>
<?php if (!empty($pageJsUrl)): ?>
<script defer src="<?= htmlspecialchars($pageJsUrl) ?>?v=<?= htmlspecialchars($pageJsHash ?? '') ?>"></script>
<?php endif; ?>

View file

@ -1,61 +1,23 @@
<?php if (!empty($pageContent)): ?>
<div class="list-intro">
<article class="list-intro">
<?= $pageContent ?>
</div>
</article>
<?php endif; ?>
<ul class="compact-list">
<?php foreach ($items as $item): ?>
<li>
<a href="<?= htmlspecialchars($item['url']) ?>">
<strong><?= htmlspecialchars($item['title']) ?></strong>
<?php if (($metadata['show_date'] ?? true) && !empty($item['date'])): ?>
<time><?= htmlspecialchars($item['date']) ?></time>
<section>
<ul class="compact-list">
<?php foreach ($items as $item): ?>
<li>
<a href="<?= htmlspecialchars($item['url']) ?>">
<strong><?= htmlspecialchars($item['title']) ?></strong>
<?php if (($metadata['show_date'] ?? true) && !empty($item['date'])): ?>
<time><?= htmlspecialchars($item['date']) ?></time>
<?php endif; ?>
</a>
<?php if (!empty($item['summary'])): ?>
<p><?= htmlspecialchars($item['summary']) ?></p>
<?php endif; ?>
</a>
<?php if (!empty($item['summary'])): ?>
<p><?= htmlspecialchars($item['summary']) ?></p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<style>
.compact-list {
list-style: none;
padding: 0;
max-width: var(--size-content);
& li {
border-block-end: 1px solid var(--color-border);
padding-block: var(--space-s);
&:first-child {
padding-block-start: 0;
}
}
& a {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: var(--space-s);
text-decoration: none;
&:hover strong {
text-decoration: underline;
}
}
& time {
white-space: nowrap;
font-size: 0.875rem;
}
& p {
margin-block-start: var(--space-xs);
color: var(--color-muted);
font-size: 0.9rem;
}
}
</style>
</li>
<?php endforeach; ?>
</ul>
</section>

View file

@ -1,48 +1,27 @@
<?php if (!empty($pageContent)): ?>
<div class="list-intro">
<article class="list-intro">
<?= $pageContent ?>
</div>
</article>
<?php endif; ?>
<div class="grid">
<?php foreach ($items as $item): ?>
<article class="card">
<?php if (!empty($item['cover'])): ?>
<img src="<?= htmlspecialchars($item['cover']) ?>" alt="">
<?php endif; ?>
<h3><a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?></a></h3>
<?php if (($metadata['show_date'] ?? true) && !empty($item['date'])): ?>
<time><?= htmlspecialchars($item['date']) ?></time>
<?php endif; ?>
<?php if (!empty($item['summary'])): ?>
<p><?= htmlspecialchars($item['summary']) ?></p>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
<section>
<div class="grid">
<?php foreach ($items as $item): ?>
<article class="card">
<?php if (!empty($item['cover'])): ?>
<img src="<?= htmlspecialchars($item['cover']) ?>" alt="">
<?php endif; ?>
<style>
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
gap: var(--space-m);
}
<h3><a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?></a></h3>
.card {
border: 1px solid var(--color-border);
border-radius: 0.5rem;
padding: var(--space-s);
& img {
margin-block-end: var(--space-s);
border-radius: 0.25rem;
}
& h3 {
margin-block-start: 0;
}
}
</style>
<?php if (($metadata['show_date'] ?? true) && !empty($item['date'])): ?>
<time><?= htmlspecialchars($item['date']) ?></time>
<?php endif; ?>
<?php if (!empty($item['summary'])): ?>
<p><?= htmlspecialchars($item['summary']) ?></p>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
</section>

View file

@ -1,25 +1,27 @@
<?php if (!empty($pageContent)): ?>
<div class="list-intro">
<article class="list-intro">
<?= $pageContent ?>
</div>
</article>
<?php endif; ?>
<div class="list">
<section>
<?php foreach ($items as $item): ?>
<article class="list-item">
<?php if (!empty($item['cover'])): ?>
<img src="<?= htmlspecialchars($item['cover']) ?>" alt="">
<a href="<?= htmlspecialchars($item['url']) ?>">
<img src="<?= htmlspecialchars($item['cover']) ?>" alt="">
</a>
<?php endif; ?>
<h2><a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?></a></h2>
<?php if (($metadata['show_date'] ?? true) && !empty($item['date'])): ?>
<time><?= htmlspecialchars($item['date']) ?></time>
<?php endif; ?>
<?php if (!empty($item['summary'])): ?>
<p><?= htmlspecialchars($item['summary']) ?></p>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
</section>