Skip to content

tags: emit data-count on .tag-cloud-item for CSS-side weighting #100

@vnykmshr

Description

@vnykmshr

The /tags template emits:

<a href="/tags/{{ .Tag }}" class="tag-cloud-item">
    <span class="tag-cloud-label">{{ .Tag }}</span>
    <span class="tag-cloud-count">{{ .Count }}</span>
</a>

CSS can style by tag slug (attribute selector on href), but the count lives in a child element's text content — which CSS can't read. So size/weight-by-popularity styling needs either JS or upstream help.

Ask: add data-count="{{ .Count }}" to the anchor itself, so operators can write:

.tag-cloud-item[data-count="1"] { opacity: .6; font-size: 0.9em; }
.tag-cloud-item:not([data-count="1"]):not([data-count="2"]) {
    font-weight: 600;
}

One-template tweak (web/templates/tags.html:12), opens CSS-side visual hierarchy for any forker without JS.

(Adjacent but out of scope: .feed-tag chips on article.html don't carry count either. Probably fine — chip context already implies "this article has this tag." Happy to file separately if you want symmetry.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions