feat : page /books et section livres accueil (v1.6.26)

- #99 : page publique /books — catalogue des books avec ≥1 article publié
- #100 : section « Livres » sur la homepage (max 6, après redécouvertes)
- CSS : .book-grid, .book-home-card*, .home-section-more
- .htaccess : règle RewriteRule ^books/?$

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 16:53:23 +02:00
parent 84d4b12fb2
commit c140ba4069
7 changed files with 190 additions and 1 deletions
+35
View File
@@ -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);
}
// ──────────────────────────────────────────────────────────────────