feat: section articles proches dans la vue article
This commit is contained in:
@@ -258,6 +258,27 @@ $hasSources = (!empty($externalLinks) || !empty($files))
|
||||
<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>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user