v1.6.26 — page /books, section livres accueil, fix onglet books #102
@@ -5,6 +5,14 @@ Format : [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/) — versionnag
|
||||
|
||||
---
|
||||
|
||||
## [1.6.26] - 2026-05-16
|
||||
|
||||
### Ajouté
|
||||
- Page publique `/books` — catalogue de tous les livres avec ≥ 1 article publié, cards cover/titre/description/nombre de pages (#99)
|
||||
- Accueil : section « Livres » (max 6) après les redécouvertes avec lien « Voir tous → /books » (#100)
|
||||
|
||||
---
|
||||
|
||||
## [1.6.25] - 2026-05-16
|
||||
|
||||
### Ajouté
|
||||
|
||||
@@ -15,6 +15,9 @@ RewriteRule ^ - [L]
|
||||
# URL propre pour les articles : /post/<slug>
|
||||
RewriteRule ^post/([a-z0-9][a-z0-9-]*)/?$ /index.php?action=view&slug=$1 [L,QSA]
|
||||
|
||||
# Catalogue de tous les livres : /books
|
||||
RewriteRule ^books/?$ /index.php?action=books_list [L,QSA]
|
||||
|
||||
# Livres : /book/<slug>
|
||||
RewriteRule ^book/([a-z0-9][a-z0-9-]*)/?$ /index.php?action=book&book_slug=$1 [L,QSA]
|
||||
|
||||
|
||||
@@ -1844,6 +1844,68 @@ main { transition: max-width .22s ease; }
|
||||
|
||||
/* ─── Livres ─────────────────────────────────────────────────────── */
|
||||
|
||||
/* Grille catalogue /books + section accueil */
|
||||
.book-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.book-home-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: var(--vl-radius);
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
background: var(--vl-card-bg, var(--bs-body-bg));
|
||||
box-shadow: var(--vl-shadow-sm, 0 1px 3px rgba(0,0,0,.08));
|
||||
transition: transform .15s, box-shadow .15s;
|
||||
}
|
||||
.book-home-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--vl-shadow-md, 0 4px 12px rgba(0,0,0,.14));
|
||||
color: inherit;
|
||||
}
|
||||
.book-home-card-cover {
|
||||
height: 120px;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.book-home-card-body {
|
||||
padding: .7rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: .2rem;
|
||||
flex: 1;
|
||||
}
|
||||
.book-home-card-title {
|
||||
font-weight: 600;
|
||||
font-size: .9rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.book-home-card-desc {
|
||||
font-size: .78rem;
|
||||
color: var(--vl-muted);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.book-home-card-meta {
|
||||
font-size: .72rem;
|
||||
color: var(--vl-muted);
|
||||
margin-top: auto;
|
||||
padding-top: .3rem;
|
||||
}
|
||||
.home-section-more {
|
||||
font-size: .75rem;
|
||||
font-weight: 400;
|
||||
margin-left: .5rem;
|
||||
color: var(--vl-accent);
|
||||
text-decoration: none;
|
||||
letter-spacing: 0;
|
||||
text-transform: none;
|
||||
}
|
||||
.home-section-more:hover { text-decoration: underline; }
|
||||
|
||||
/* Bandeau dans un article appartenant à un livre */
|
||||
.book-article-banner {
|
||||
border-radius: var(--vl-radius);
|
||||
|
||||
@@ -3530,6 +3530,25 @@ switch ($action) {
|
||||
include BASE_PATH . '/templates/search.php';
|
||||
break;
|
||||
|
||||
case 'books_list':
|
||||
$allCats = $articles->getCategories();
|
||||
$booksData = [];
|
||||
foreach ($books->getAll() as $_bk) {
|
||||
$_published = [];
|
||||
foreach ($_bk['articles'] ?? [] as $_aSlug) {
|
||||
$_a = $articles->getBySlug($_aSlug);
|
||||
if ($_a && $_a['published'] && strtotime((string)($_a['published_at'] ?? '')) <= time()) {
|
||||
$_published[] = $_a;
|
||||
}
|
||||
}
|
||||
if (empty($_published)) continue;
|
||||
$booksData[] = ['book' => $_bk, 'count' => count($_published), 'first' => $_published[0]];
|
||||
}
|
||||
unset($_bk, $_published, $_aSlug, $_a);
|
||||
$seoDescription = 'Retrouvez tous les livres et séries d\'articles publiés sur ' . siteTitle() . '.';
|
||||
include BASE_PATH . '/templates/books_list.php';
|
||||
break;
|
||||
|
||||
case 'book':
|
||||
$bookSlug = trim($_GET['book_slug'] ?? '');
|
||||
$book = $books->getBySlug($bookSlug);
|
||||
@@ -3834,6 +3853,22 @@ switch ($action) {
|
||||
$recentlyUpdated[] = $_a;
|
||||
}
|
||||
unset($_sevenDaysAgo, $_latestUuids, $_popularUuids, $_heroUuid, $_a, $allPostsMap);
|
||||
|
||||
// Books à mettre en avant (max 6, ayant ≥ 1 article publié)
|
||||
$homeBooks = [];
|
||||
foreach ($books->getAll() as $_bk) {
|
||||
$_published = [];
|
||||
foreach ($_bk['articles'] ?? [] as $_aSlug) {
|
||||
$_a = $articles->getBySlug($_aSlug);
|
||||
if ($_a && $_a['published'] && strtotime((string)($_a['published_at'] ?? '')) <= time()) {
|
||||
$_published[] = $_a;
|
||||
}
|
||||
}
|
||||
if (empty($_published)) continue;
|
||||
$homeBooks[] = ['book' => $_bk, 'count' => count($_published), 'first' => $_published[0]];
|
||||
if (count($homeBooks) >= 6) break;
|
||||
}
|
||||
unset($_bk, $_published, $_aSlug, $_a);
|
||||
}
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.6.25
|
||||
1.6.26
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="container py-4">
|
||||
|
||||
<div class="d-flex align-items-baseline justify-content-between mb-4">
|
||||
<h1 class="h3 mb-0">Livres</h1>
|
||||
<span class="text-muted small"><?= count($booksData) ?> livre<?= count($booksData) > 1 ? 's' : '' ?></span>
|
||||
</div>
|
||||
|
||||
<?php if (empty($booksData)): ?>
|
||||
<p class="text-muted">Aucun livre disponible pour l'instant.</p>
|
||||
<?php else: ?>
|
||||
|
||||
<div class="book-grid">
|
||||
<?php foreach ($booksData as $_bd):
|
||||
$_book = $_bd['book'];
|
||||
$_first = $_bd['first'];
|
||||
$_count = $_bd['count'];
|
||||
$_cover = $_first['cover'] ?? '';
|
||||
$_cat = trim($_first['category'] ?? '');
|
||||
$_coverStyle = $_cover !== ''
|
||||
? "background-image:url('/file?uuid=" . rawurlencode($_first['uuid']) . "&name=" . rawurlencode($_cover) . "')"
|
||||
: 'background:' . coverGradient($_cat !== '' ? $_cat : $_first['uuid'], $allCats ?? []);
|
||||
?>
|
||||
<a href="/book/<?= rawurlencode($_book['slug']) ?>" class="book-home-card">
|
||||
<div class="book-home-card-cover" style="<?= $_coverStyle ?>"></div>
|
||||
<div class="book-home-card-body">
|
||||
<div class="book-home-card-title"><?= htmlspecialchars($_book['title']) ?></div>
|
||||
<?php if (!empty($_book['description'])): ?>
|
||||
<div class="book-home-card-desc"><?= htmlspecialchars(mb_strimwidth($_book['description'], 0, 100, '…')) ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="book-home-card-meta"><?= $_count ?> page<?= $_count > 1 ? 's' : '' ?></div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
$title = 'Livres — ' . siteTitle();
|
||||
$metaRobots = 'index, follow';
|
||||
$canonical = rtrim((string)($_ENV['APP_URL'] ?? getenv('APP_URL') ?: ''), '/') . '/books';
|
||||
include BASE_PATH . '/templates/layout.php';
|
||||
@@ -214,6 +214,38 @@ function _renderCard(array $post, array $privateCats, array $allCats, \Parsedown
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($homeBooks ?? [])): ?>
|
||||
<section class="home-section">
|
||||
<h2 class="home-section-title">
|
||||
Livres
|
||||
<a href="/books" class="home-section-more">Voir tous →</a>
|
||||
</h2>
|
||||
<div class="book-grid">
|
||||
<?php foreach ($homeBooks as $_hb):
|
||||
$_book = $_hb['book'];
|
||||
$_first = $_hb['first'];
|
||||
$_count = $_hb['count'];
|
||||
$_cover = $_first['cover'] ?? '';
|
||||
$_cat = trim($_first['category'] ?? '');
|
||||
$_coverStyle = $_cover !== ''
|
||||
? "background-image:url('/file?uuid=" . rawurlencode($_first['uuid']) . "&name=" . rawurlencode($_cover) . "')"
|
||||
: 'background:' . coverGradient($_cat !== '' ? $_cat : $_first['uuid'], $allCats ?? []);
|
||||
?>
|
||||
<a href="/book/<?= rawurlencode($_book['slug']) ?>" class="book-home-card">
|
||||
<div class="book-home-card-cover" style="<?= $_coverStyle ?>"></div>
|
||||
<div class="book-home-card-body">
|
||||
<div class="book-home-card-title"><?= htmlspecialchars($_book['title']) ?></div>
|
||||
<?php if (!empty($_book['description'])): ?>
|
||||
<div class="book-home-card-desc"><?= htmlspecialchars(mb_strimwidth($_book['description'], 0, 80, '…')) ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="book-home-card-meta"><?= $_count ?> page<?= $_count > 1 ? 's' : '' ?></div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else: /* ─── VUE PAGINÉE / FILTRÉE ─────────────────────────────── */ ?>
|
||||
|
||||
<?php if ($cursor === '' && $filterCat === ''): ?>
|
||||
|
||||
Reference in New Issue
Block a user