diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-21 22:56:01 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-21 22:56:01 +0200 |
| commit | 88d46796cb84e81e1c502ccdf02ea22890e511d5 (patch) | |
| tree | 251a9b99f9d0a8cd8361e1216566954981cb7b08 /themes/danix-xyz-hacker/assets/css/main.min.css | |
| parent | 2236d07a5247cab38e0e6b524bdfb26c12c143a8 (diff) | |
| download | danixxyz-88d46796cb84e81e1c502ccdf02ea22890e511d5.tar.gz danixxyz-88d46796cb84e81e1c502ccdf02ea22890e511d5.zip | |
feat: Add reusable tag cloud partial with A11y and dark/light mode support
- Create tag-cloud.html partial with flexible dict interface:
* showCount (bool): Toggle count badges
* wrapInWidget (bool): Sidebar widget wrapper with .sidebar-widget class
* maxTags (int): Limit shown tags (used for sidebar: 15 max)
* headingLevel (h2|h3): Configurable heading element
- Implement visual tier scaling by frequency (3 tiers):
* low: 0.75rem, 0.75 opacity — uncommon tags
* medium: 0.875rem, 0.88 opacity — moderate frequency
* high: 1rem, 1 opacity, accent border — popular tags
- Add .tag-cloud and .tag-tier-* CSS classes (main.css):
* Uses CSS variables (--accent, --border, --text-dim) for dark/light compatibility
* Focus ring matches site standard (outline-offset: 2px)
* Hover state: accent border + subtle bg tint
* prefers-reduced-motion: transitions disabled
- Integrate in 3 locations:
* Homepage (layouts/index.html): Full cloud with counts
* Article sidebar (layouts/partials/sidebar.html): Compact widget, 15 max, no counts
* 404 pages (404.en.html, 404.it.html): Full cloud between recent articles and nav
- A11y implementation:
* <section aria-labelledby> landmark (non-sidebar mode)
* <nav aria-label="Browse by topic"> named navigation
* Each link aria-label includes count text even when visual badge hidden
* <span aria-hidden="true"> on count badge to avoid duplication
* Proper heading hierarchy (h2 homepage, h3 on 404)
- Add i18n keys (en.yaml, it.yaml):
* tagCloud: "Explore Topics" / "Esplora gli argomenti"
* exploreTopics: "Browse by topic" / "Sfoglia per argomento"
- URL handling: Use .Page.RelPermalink from OrderedTaxonomyEntry — no manual /tags/ construction, language-aware paths work automatically
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'themes/danix-xyz-hacker/assets/css/main.min.css')
| -rw-r--r-- | themes/danix-xyz-hacker/assets/css/main.min.css | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/assets/css/main.min.css b/themes/danix-xyz-hacker/assets/css/main.min.css index 8604392..236b11c 100644 --- a/themes/danix-xyz-hacker/assets/css/main.min.css +++ b/themes/danix-xyz-hacker/assets/css/main.min.css @@ -1448,6 +1448,65 @@ button, margin-bottom: 1.5rem; } +/* ===================== + Tag Cloud Component + ===================== */ + +.tag-cloud { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + align-items: baseline; +} + +.tag-cloud-link { + display: inline-flex; + align-items: center; + gap: 0.375rem; + padding: 0.25rem 0.625rem; + border: 1px solid var(--border); + border-radius: 0.25rem; + font-family: var(--font-mono, 'JetBrains Mono', monospace); + font-size: 0.75rem; + color: var(--text-dim); + text-decoration: none; + transition: border-color 150ms ease-out, color 150ms ease-out, background-color 150ms ease-out; + white-space: nowrap; + line-height: 1.4; +} + +.tag-cloud-link:hover { + border-color: rgba(var(--accent-rgb), 0.5); + color: var(--accent); + background-color: rgba(var(--accent-rgb), 0.06); +} + +.tag-cloud-link:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; + border-radius: 0.25rem; +} + +.tag-cloud-count { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0 0.375rem; + border-radius: 9999px; + font-size: 0.65em; + font-weight: 600; + background-color: rgba(var(--accent-rgb), 0.12); + color: var(--accent); + line-height: 1.6; + min-width: 1.2em; +} + +@media (prefers-reduced-motion: reduce) { + .tag-cloud-link { + transition: none; + } +} + .share-grid { display: grid; grid-template-columns: repeat(3, 50px); |
