refactor: supprime sidebar gauche, fusionne related+similar en 'A lire aussi'
This commit is contained in:
+14
-61
@@ -30,35 +30,11 @@ if ($files) {
|
||||
}
|
||||
|
||||
$externalLinks = $article['external_links'] ?? [];
|
||||
$hasLeftSidebar = !empty($categorySidebar ?? []);
|
||||
?>
|
||||
<div class="row g-4 align-items-start flex-lg-nowrap">
|
||||
|
||||
<?php if ($hasLeftSidebar): ?>
|
||||
<div class="post-sidebar-col order-2 order-lg-1">
|
||||
<aside class="left-sidebar">
|
||||
<?php foreach ($categorySidebar as $catName => $catArticles): ?>
|
||||
<div class="left-sidebar-section">
|
||||
<a href="/categorie/<?= rawurlencode($catName) ?>" class="left-sidebar-cat">
|
||||
<?= htmlspecialchars($catName) ?>
|
||||
</a>
|
||||
<ul class="left-sidebar-list">
|
||||
<?php foreach ($catArticles as $ca): ?>
|
||||
<li>
|
||||
<a href="/post/<?= rawurlencode($ca['slug'] ?? '') ?>">
|
||||
<?= htmlspecialchars($ca['title']) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</aside>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Colonne principale -->
|
||||
<div class="col order-1 order-lg-2">
|
||||
<div class="col">
|
||||
|
||||
<div class="card mb-4">
|
||||
<?php if (!$article['published']): ?>
|
||||
@@ -235,45 +211,22 @@ $hasSources = (!empty($externalLinks) || !empty($files))
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h6 class="related-sidebar-title">Dans la même catégorie</h6>
|
||||
<?php if (!empty($relatedArticles ?? [])): ?>
|
||||
<?php foreach ($relatedArticles as $rel):
|
||||
$relCover = $rel['cover'] ?? '';
|
||||
$relCat = trim($rel['category'] ?? '');
|
||||
$relGradient = coverGradient($relCat !== '' ? $relCat : $rel['uuid'], $allCats ?? []);
|
||||
$relDate = date('d/m/Y', strtotime((string)($rel['published_at'] ?? $rel['created_at'] ?? '')));
|
||||
<?php if (!empty($alsoReadArticles ?? [])): ?>
|
||||
<h6 class="related-sidebar-title">À lire aussi</h6>
|
||||
<?php foreach ($alsoReadArticles as $_also):
|
||||
$_alsoCover = $_also['cover'] ?? '';
|
||||
$_alsoCat = trim($_also['category'] ?? '');
|
||||
$_alsoGradient = coverGradient($_alsoCat !== '' ? $_alsoCat : $_also['uuid'], $allCats ?? []);
|
||||
$_alsoDate = date('d/m/Y', strtotime((string)($_also['published_at'] ?? $_also['created_at'] ?? '')));
|
||||
?>
|
||||
<a href="/post/<?= rawurlencode($rel['slug'] ?? '') ?>" class="related-card">
|
||||
<div class="related-card-thumb" style="<?= $relCover !== ''
|
||||
? 'background-image:url(/file?uuid=' . rawurlencode($rel['uuid']) . '&name=' . rawurlencode($relCover) . ');background-size:cover;background-position:center'
|
||||
: 'background:' . htmlspecialchars($relGradient) ?>">
|
||||
<a href="/post/<?= rawurlencode($_also['slug'] ?? '') ?>" class="related-card">
|
||||
<div class="related-card-thumb" style="<?= $_alsoCover !== ''
|
||||
? 'background-image:url(/file?uuid=' . rawurlencode($_also['uuid']) . '&name=' . rawurlencode($_alsoCover) . ');background-size:cover;background-position:center'
|
||||
: 'background:' . htmlspecialchars($_alsoGradient) ?>">
|
||||
</div>
|
||||
<div class="related-card-body">
|
||||
<div class="related-card-title"><?= htmlspecialchars($rel['title']) ?></div>
|
||||
<div class="related-card-date"><?= $relDate ?></div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<p class="text-muted small">Aucun autre article dans cette catégorie.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($similarArticles ?? [])): ?>
|
||||
<h6 class="related-sidebar-title mt-4">Articles proches</h6>
|
||||
<?php foreach ($similarArticles as $sim):
|
||||
$simCover = $sim['cover'] ?? '';
|
||||
$simCat = trim($sim['category'] ?? '');
|
||||
$simGradient = coverGradient($simCat !== '' ? $simCat : $sim['uuid'], $allCats ?? []);
|
||||
$simDate = date('d/m/Y', strtotime((string)($sim['published_at'] ?? $sim['created_at'] ?? '')));
|
||||
?>
|
||||
<a href="/post/<?= rawurlencode($sim['slug'] ?? '') ?>" class="related-card">
|
||||
<div class="related-card-thumb" style="<?= $simCover !== ''
|
||||
? 'background-image:url(/file?uuid=' . rawurlencode($sim['uuid']) . '&name=' . rawurlencode($simCover) . ');background-size:cover;background-position:center'
|
||||
: 'background:' . htmlspecialchars($simGradient) ?>">
|
||||
</div>
|
||||
<div class="related-card-body">
|
||||
<div class="related-card-title"><?= htmlspecialchars($sim['title']) ?></div>
|
||||
<div class="related-card-date"><?= $simDate ?></div>
|
||||
<div class="related-card-title"><?= htmlspecialchars($_also['title']) ?></div>
|
||||
<div class="related-card-date"><?= $_alsoDate ?></div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Reference in New Issue
Block a user