diff --git a/public/feed.php b/public/feed.php index ba4b904..0b3696a 100644 --- a/public/feed.php +++ b/public/feed.php @@ -4,16 +4,16 @@ declare(strict_types=1); define('BASE_PATH', realpath(__DIR__ . '/../')); -require_once BASE_PATH . '/bootstrap.php'; -require_once BASE_PATH . '/src/helpers.php'; require_once BASE_PATH . '/src/auth.php'; require_once BASE_PATH . '/config/config.php'; require_once BASE_PATH . '/src/ArticleManager.php'; +require_once BASE_PATH . '/src/Parsedown.php'; const FEED_PAGE_SIZE = 20; $articles = new ArticleManager(BASE_PATH . '/data'); $privateCats = $articles->getPrivateCategories(); +$Parsedown = new Parsedown(); $now = time(); $base = rtrim(APP_URL, '/'); @@ -29,88 +29,12 @@ $all = array_values(array_filter( } )); -// ─── Détection navigateur ──────────────────────────────────────────────────── -$accept = $_SERVER['HTTP_ACCEPT'] ?? ''; -$isBrowser = str_contains($accept, 'text/html') - && !str_contains($accept, 'application/rss+xml'); - -if ($isBrowser) { - require_once BASE_PATH . '/src/Parsedown.php'; - $Parsedown = new Parsedown(); - - $feedUrl = $base . '/feed'; - $recentItems = array_slice($all, 0, 10); - - ob_start(); - ?> -
-
- -
-

Flux RSS — varlog

-

Journal personnel de Cédrix — informatique, hack et loisirs techniques.

-
- -
-
-

S'abonner

-

- Copiez cette URL dans votre lecteur RSS (Miniflux, Feedly, NetNewsWire…) - pour recevoir les nouveaux articles automatiquement. -

-
- - -
-
-
- -

Derniers articles

-
- text($a['content'] ?? '')), 0, 100, '…'); - $cat = trim($a['category'] ?? ''); - ?> - -
- - -
- - - -

-
- -
- -
-
- $base . '/feed' . ($p > 1 ? '?page=' . $p : ''); +$feedUrl = static fn (int $p): string => $base . '/feed' . ($p > 1 ? '?page=' . $p : ''); $lastBuild = ''; foreach ($all as $a) { @@ -139,16 +63,16 @@ echo '' . "\n"; - + 1): ?> - - + + -