diff --git a/public/assets/css/style.css b/public/assets/css/style.css index f4dc4ab..d7b5933 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -1195,36 +1195,48 @@ footer.mt-5 { margin-top: 0 !important; } .tag-cloud { display: flex; flex-wrap: wrap; - gap: .4rem .7rem; - align-items: baseline; - padding: 1rem 0; + gap: .5rem; + align-items: center; + padding: 1.25rem 0; border-top: 1px solid var(--vl-border, #e5e7eb); } .tag-cloud-item { + display: inline-flex; + align-items: center; + gap: .3em; + padding: .25em .75em; + border-radius: 999px; + border: 1px solid var(--vl-border, #e5e7eb); + background: transparent; color: var(--vl-muted); text-decoration: none; - transition: color .15s; white-space: nowrap; + transition: background .15s, color .15s, border-color .15s; + font-size: .85rem !important; } -.tag-cloud-item:hover, -.tag-cloud-item.active { - color: var(--vl-accent); +.tag-cloud-item:hover { + background: var(--vl-accent); + border-color: var(--vl-accent); + color: #fff; } .tag-cloud-item.active { + background: var(--vl-accent); + border-color: var(--vl-accent); + color: #fff; font-weight: 600; } .tag-count { - font-size: .65em; - opacity: .6; + font-size: .8em; + opacity: .7; } .tag-cloud-reset { margin-left: auto; - font-size: .85em; + font-size: .85rem; color: var(--vl-muted); text-decoration: none; } diff --git a/public/index.php b/public/index.php index 102e3e0..d586e1a 100644 --- a/public/index.php +++ b/public/index.php @@ -1770,7 +1770,29 @@ switch ($action) { default: $privateCats = $articles->getPrivateCategories(); $allCats = $articles->getCategories(); - $filterCat = trim($_GET['cat'] ?? ''); + + if (array_key_exists('cat', $_GET)) { + $filterCat = trim($_GET['cat']); + if ($filterCat === '') { + // Réinitialisation explicite → effacer le cookie et rediriger + setcookie('varlog_cat', '', time() - 3600, '/', '', $isHttps, true); + header('Location: /', true, 302); + exit; + } + // Sauvegarder la catégorie choisie (1 an) + setcookie('varlog_cat', $filterCat, time() + 365 * 24 * 3600, '/', '', $isHttps, true); + } else { + // Pas de paramètre → appliquer le cookie si la catégorie existe toujours + $savedCat = trim($_COOKIE['varlog_cat'] ?? ''); + if ($savedCat !== '' && isset($allCats[$savedCat])) { + header('Location: /categorie/' . rawurlencode($savedCat), true, 302); + exit; + } + if ($savedCat !== '' && !isset($allCats[$savedCat])) { + setcookie('varlog_cat', '', time() - 3600, '/', '', $isHttps, true); + } + $filterCat = ''; + } $allPosts = array_values(array_filter($articles->getAll(), static function (array $a) use ($privateCats, $filterCat): bool { if (!$a['published']) { return canDoOnArticle('view_drafts', $a); diff --git a/templates/post_list.php b/templates/post_list.php index 1e5cd5a..b0a746a 100644 --- a/templates/post_list.php +++ b/templates/post_list.php @@ -113,15 +113,14 @@ if (!empty($_tagCats)): : round(0.8 + ($_catCount - $_minCount) / ($_maxCount - $_minCount) * 0.9, 2); $_active = ($filterCat === $_catName); ?> - + - + - × tout afficher + × tout afficher