feat: stockage articles en fichiers Markdown, SSO intégré, URLs propres
This commit is contained in:
+11
-8
@@ -15,32 +15,35 @@ ob_start();
|
||||
?>
|
||||
|
||||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
|
||||
<?php foreach ($posts as $post): ?>
|
||||
<?php foreach ($posts as $i => $post): ?>
|
||||
<?php
|
||||
$html = $Parsedown->text($post['content']);
|
||||
$preview = mb_strimwidth(strip_tags($html), 0, 120, '…');
|
||||
$gradient = $coverGradients[$post['id'] % count($coverGradients)];
|
||||
$gradient = $coverGradients[$i % count($coverGradients)];
|
||||
$postUrl = '/post/' . rawurlencode($post['slug']);
|
||||
?>
|
||||
<div class="col">
|
||||
<article class="card h-100">
|
||||
<div class="card-cover" style="background: <?= $gradient ?>"></div>
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h2 class="card-title">
|
||||
<a href="route.php?action=view&id=<?= $post['id'] ?>">
|
||||
<a href="<?= htmlspecialchars($postUrl) ?>">
|
||||
<?= htmlspecialchars($post['title']) ?>
|
||||
</a>
|
||||
<?php if (!$post['is_published']): ?>
|
||||
<?php if (!$post['published']): ?>
|
||||
<span class="badge bg-warning ms-1">Brouillon</span>
|
||||
<?php endif; ?>
|
||||
</h2>
|
||||
<p class="card-text flex-grow-1"><?= htmlspecialchars($preview) ?></p>
|
||||
<div class="post-entry-meta mt-auto">
|
||||
<span><?= date('d/m/Y', strtotime($post['created_at'])) ?></span>
|
||||
<a href="route.php?action=edit&id=<?= $post['id'] ?>" class="post-entry-edit">modifier</a>
|
||||
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="post-entry-read">→ lire</a>
|
||||
<span><?= htmlspecialchars(date('d/m/Y', strtotime((string)($post['created_at'] ?? '')))) ?></span>
|
||||
<?php if (function_exists('isAdmin') && isAdmin()): ?>
|
||||
<a href="/?action=edit&uuid=<?= htmlspecialchars($post['uuid']) ?>" class="post-entry-edit">modifier</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= htmlspecialchars($postUrl) ?>" class="post-entry-read">→ lire</a>
|
||||
</div>
|
||||
</div>
|
||||
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="stretched-link"></a>
|
||||
<a href="<?= htmlspecialchars($postUrl) ?>" class="stretched-link"></a>
|
||||
</article>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Reference in New Issue
Block a user