feat: titre et claim configurables depuis l'admin

This commit is contained in:
Cedric Abonnel
2026-05-12 22:30:00 +02:00
parent 8f0fe0dbff
commit b81750616f
1015 changed files with 1832 additions and 1418 deletions
+1 -1
View File
@@ -101,5 +101,5 @@ ob_start();
<?php
$content = ob_get_clean();
$title = 'À propos — varlog';
$title = 'À propos — ' . siteTitle();
include __DIR__ . '/layout.php';
+36 -1
View File
@@ -44,6 +44,10 @@ function adminStatusBadge(array $a, int $now): string
<li class="nav-item">
<a class="nav-link" href="/categories">Catégories</a>
</li>
<li class="nav-item">
<a class="nav-link <?= $tab === 'site' ? 'active' : '' ?>"
href="/admin/site">Site</a>
</li>
<?php endif; ?>
</ul>
@@ -322,9 +326,40 @@ function adminStatusBadge(array $a, int $now): string
</div>
<?php elseif ($tab === 'site' && isAdmin()): ?>
<?php if (!empty($siteSettingsSaved)): ?>
<div class="alert alert-success py-2 mb-3">Paramètres enregistrés.</div>
<?php endif; ?>
<div class="card" style="max-width:540px">
<div class="card-header">Paramètres du site</div>
<div class="card-body">
<form method="post" action="/?action=admin_save_site">
<div class="mb-3">
<label for="site-title" class="form-label small fw-semibold">Titre du site</label>
<input type="text" id="site-title" name="site_title"
class="form-control form-control-sm"
value="<?= htmlspecialchars(siteTitle()) ?>"
required maxlength="80">
<div class="form-text">Affiché dans la barre de navigation et les onglets.</div>
</div>
<div class="mb-3">
<label for="site-claim" class="form-label small fw-semibold">Claim / accroche</label>
<input type="text" id="site-claim" name="site_claim"
class="form-control form-control-sm"
value="<?= htmlspecialchars(siteClaim()) ?>"
required maxlength="200">
<div class="form-text">Affiché sous le titre dans la navbar et dans le pied de page.</div>
</div>
<button type="submit" class="btn btn-primary btn-sm">Enregistrer</button>
</form>
</div>
</div>
<?php endif; ?>
<?php
$content = ob_get_clean();
$title = 'Administration — varlog';
$title = 'Administration — ' . siteTitle();
include __DIR__ . '/layout.php';
+1 -1
View File
@@ -140,5 +140,5 @@ ob_start();
<?php
$content = ob_get_clean();
$title = 'Contact — varlog';
$title = 'Contact — ' . siteTitle();
include __DIR__ . '/layout.php';
+10 -10
View File
@@ -2,21 +2,21 @@
<html lang="fr">
<head>
<meta charset="UTF-8">
<title><?= htmlspecialchars(($seoTitle ?? '') ?: ($title ?? 'varlog')) ?></title>
<title><?= htmlspecialchars(($seoTitle ?? '') ?: ($title ?? siteTitle())) ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- SEO -->
<meta name="description" content="<?= htmlspecialchars(($seoDescription ?? '') ?: 'Varlog est un journal personnel en ligne de Cédrix. Informatique, hack et loisirs techniques.') ?>">
<meta name="description" content="<?= htmlspecialchars(($seoDescription ?? '') ?: siteClaim()) ?>">
<meta name="robots" content="<?= htmlspecialchars($metaRobots ?? 'index, follow') ?>">
<link rel="canonical" href="<?= htmlspecialchars($canonical ?? $ogUrl ?? rtrim(APP_URL, '/') . '/') ?>">
<!-- Open Graph -->
<meta property="og:title" content="<?= htmlspecialchars(($seoTitle ?? '') ?: ($title ?? 'varlog')) ?>">
<meta property="og:description" content="<?= htmlspecialchars(($seoDescription ?? '') ?: 'Découvrez les derniers articles publiés sur le journal personnel varlog.') ?>">
<meta property="og:title" content="<?= htmlspecialchars(($seoTitle ?? '') ?: ($title ?? siteTitle())) ?>">
<meta property="og:description" content="<?= htmlspecialchars(($seoDescription ?? '') ?: siteClaim()) ?>">
<meta property="og:type" content="<?= htmlspecialchars($ogType ?? 'website') ?>">
<meta property="og:locale" content="fr_FR">
<meta property="og:url" content="<?= htmlspecialchars($ogUrl ?? APP_URL) ?>">
<meta property="og:site_name" content="varlog">
<meta property="og:site_name" content="<?= htmlspecialchars(siteTitle()) ?>">
<?php if (!empty($ogImage ?? '')): ?>
<meta property="og:image" content="<?= htmlspecialchars($ogImage) ?>">
<meta property="og:image:width" content="1200">
@@ -31,7 +31,7 @@
<?php endif; ?>
<!-- RSS autodiscovery -->
<link rel="alternate" type="application/rss+xml" title="varlog" href="/feed">
<link rel="alternate" type="application/rss+xml" title="<?= htmlspecialchars(siteTitle()) ?>" href="/feed">
<!-- Favicon -->
<link rel="icon" href="/assets/favicon.svg" type="image/svg+xml">
@@ -59,8 +59,8 @@
$_layoutCurrentCat = trim($_GET['cat'] ?? '');
?>
<a class="navbar-brand d-flex flex-column lh-1" href="/">
<span>varlog</span>
<small class="navbar-tagline">journal de Cédrix · informatique, hack &amp; loisirs</small>
<span><?= htmlspecialchars(siteTitle()) ?></span>
<small class="navbar-tagline"><?= htmlspecialchars(siteClaim()) ?></small>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Basculer la navigation">
<span class="navbar-toggler-icon"></span>
@@ -107,8 +107,8 @@
<div class="container">
<div class="footer-inner">
<div class="footer-about">
<strong>varlog</strong>
<p>Journal personnel de Cédrix.<br>Informatique, hack et loisirs techniques.</p>
<strong><?= htmlspecialchars(siteTitle()) ?></strong>
<p><?= htmlspecialchars(siteClaim()) ?></p>
<small>&copy; <?= date('Y') ?> &mdash; <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener">CC BY 4.0</a></small>
</div>
<nav class="footer-nav" aria-label="Liens du site">
+1 -1
View File
@@ -140,5 +140,5 @@ ob_start();
<?php
$content = ob_get_clean();
$title = 'Mentions légales — varlog';
$title = 'Mentions légales — ' . siteTitle();
include __DIR__ . '/layout.php';
+1 -1
View File
@@ -183,5 +183,5 @@ ob_start();
<?php
$content = ob_get_clean();
$title = 'Licences — varlog';
$title = 'Licences — ' . siteTitle();
include __DIR__ . '/layout.php';
+3 -4
View File
@@ -127,7 +127,7 @@ if (!empty($_tagCats)):
<?php
$content = ob_get_clean();
$title = 'varlog';
$title = siteTitle();
// Pages avec curseur = contenu non-canonique → noindex
if (!empty($cursor)) {
@@ -144,11 +144,10 @@ if (empty($cursor) && $filterCat === '') {
$jsonLd = json_encode([
'@context' => 'https://schema.org',
'@type' => 'WebSite',
'name' => 'varlog',
'name' => siteTitle(),
'url' => rtrim(APP_URL, '/') . '/',
'description' => 'Journal personnel de Cédrix. Informatique, hack et loisirs techniques.',
'description' => siteClaim(),
'inLanguage' => 'fr-FR',
'author' => ['@type' => 'Person', 'name' => 'Cédrix'],
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}