diff --git a/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/index.md b/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/index.md index 06d3a2a..e69de29 100644 --- a/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/index.md +++ b/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/index.md @@ -1,11 +0,0 @@ -accès au compte `root` - su - root - -ajout de dépots officiels dans le fichier `'' - -mise à jour globale - apt update - apt upgrade - -ajout de la fonction`sudo'' - apt install sudo \ No newline at end of file diff --git a/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/meta.json b/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/meta.json index f7cdf28..ef2558b 100644 --- a/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/meta.json +++ b/data/ad43fd21-ddcf-4ce2-b924-fdaadc8a6cdd/meta.json @@ -6,7 +6,7 @@ "published": true, "published_at": "2023-02-09 15:18:57", "created_at": "2023-02-09 15:18:57", - "updated_at": "2023-02-09 15:18:57", + "updated_at": "2026-05-12 22:54:18", "revisions": [], "cover": "", "files_meta": [], diff --git a/public/index.php b/public/index.php index b8ed7bb..2b348bc 100644 --- a/public/index.php +++ b/public/index.php @@ -575,44 +575,19 @@ switch ($action) { } } - // Sidebar gauche : autres catégories avec leurs 5 derniers articles - $categorySidebar = []; - foreach ($_allPublished as $a) { - $aCat = trim($a['category'] ?? ''); - if ($aCat === '' || $aCat === $articleCat) { - continue; - } - if (in_array($aCat, $privateCats, true) && !isLoggedIn()) { - continue; - } - if (strtotime((string)($a['published_at'] ?? '')) > time() && !isLoggedIn()) { - continue; - } - if (!isset($categorySidebar[$aCat])) { - $categorySidebar[$aCat] = []; - } - if (count($categorySidebar[$aCat]) < 5) { - $categorySidebar[$aCat][] = $a; - } - } - // Articles proches : un search par mot du titre → OR implicite, cumul des scores - $similarArticles = []; + // Articles proches par titre → OR implicite, cumul des scores require_once BASE_PATH . '/src/SearchEngine.php'; - $_simEngine = new SearchEngine(); - $_relatedUuids = array_column($relatedArticles, 'uuid'); - $_stopWords = ['avec', 'dans', 'pour', 'une', 'les', 'des', 'sur', 'par', 'qui', 'que', - 'tout', 'mais', 'donc', 'comment', 'quand', 'plus', 'cette', 'cet', 'ces', - 'mon', 'ton', 'son', 'notre', 'votre', 'leur', 'tres', 'bien', 'fait', - 'aussi', 'comme', 'plus', 'sans', 'sous', 'entre', 'vers', 'chez']; + $_simEngine = new SearchEngine(); + $_stopWords = ['avec', 'dans', 'pour', 'une', 'les', 'des', 'sur', 'par', 'qui', 'que', + 'tout', 'mais', 'donc', 'comment', 'quand', 'plus', 'cette', 'cet', 'ces', + 'mon', 'ton', 'son', 'notre', 'votre', 'leur', 'tres', 'bien', 'fait', + 'aussi', 'comme', 'sans', 'sous', 'entre', 'vers', 'chez']; $_simPool = array_values(array_filter( $_allPublished, - static function (array $a) use ($article, $privateCats, $_relatedUuids): bool { + static function (array $a) use ($article, $privateCats): bool { if ($a['uuid'] === $article['uuid']) { return false; } - if (in_array($a['uuid'], $_relatedUuids, true)) { - return false; - } if (strtotime((string)($a['published_at'] ?? '')) > time() && !isLoggedIn()) { return false; } @@ -634,11 +609,27 @@ switch ($action) { } } arsort($_scoreMap); - $similarArticles = array_map( + $_similarArticles = array_map( fn ($uuid) => $_articleMap[$uuid], array_slice(array_keys($_scoreMap), 0, 5) ); - unset($_simEngine, $_simPool, $_titleWords, $_stopWords, $_scoreMap, $_articleMap, $_relatedUuids); + unset($_simEngine, $_simPool, $_titleWords, $_stopWords, $_scoreMap, $_articleMap); + + // "À lire aussi" : similaires en premier, même catégorie pour compléter jusqu'à 5 + $alsoReadArticles = $_similarArticles; + if (count($alsoReadArticles) < 5) { + $_used = array_column($alsoReadArticles, 'uuid'); + foreach ($relatedArticles as $_ra) { + if (count($alsoReadArticles) >= 5) { + break; + } + if (!in_array($_ra['uuid'], $_used, true)) { + $alsoReadArticles[] = $_ra; + } + } + unset($_used); + } + unset($_similarArticles); unset($_allPublished); diff --git a/templates/post_view.php b/templates/post_view.php index fa34d9c..b2b5e93 100644 --- a/templates/post_view.php +++ b/templates/post_view.php @@ -30,35 +30,11 @@ if ($files) { } $externalLinks = $article['external_links'] ?? []; -$hasLeftSidebar = !empty($categorySidebar ?? []); ?>
- -
- -
- - -
+
@@ -235,45 +211,22 @@ $hasSources = (!empty($externalLinks) || !empty($files))
- - - + + - -