{tagcloud:item_ids:count:alias:count_field}

Description

Builds an HTML tag cloud (an unordered list with class tagcloud) from a set of items, weighting each tag by how often it is used. Every item becomes one list element whose CSS class, tagcloud1 through tagcloud8, encodes its rank: tagcloud1 is the most-used tag (style it largest), tagcloud8 the least. You supply the tag items as a dash-separated id list (commonly built with the ids expression), an optional maximum number of tags to show (the highest-count tags win), the AA expression rendered as each tag label, and the field or expression that yields each tag usage count. The default label alias _#HEADLINK is empty on most slices, so set your own (for example _#HEADLINE). Tags are listed in input order; only the class number is ranked by count, so the busiest tag is not necessarily first. The command outputs no styling itself - size the eight classes in your own CSS.

Parameters

item_ids required default (none)

Dash-separated list of the tag item ids, normally built with an ids expression. Each id becomes one tag in the cloud.

count optional default (all items)

Maximum number of tags to display. The highest-count tags are kept; the rest are dropped. Empty shows every supplied item.

alias optional

The AA expression rendered as each tag label - usually the tag item own headline alias. Reference the tag item with its own alias (an underscore-hash alias), not a field-getter: a field-getter binds to the surrounding item, not the tag. The documented default _#HEADLINK does not exist on most slices, so set your own.

count_field optional default a backlinks count expression

Field id or expression giving each tag usage count; the weight (class tagcloud1..8) is derived from it. Defaults to counting the tag backlinks, which is recomputed on every render unless you precount into a field.

Examples

virtual{tagcloud:{ids:9e1d2b9f88e3d6c3bf0eb967378610d6}:4:_#HEADLINE:_#NUMBER__}
Expected(top-4 cloud: Theta tagcloud3, Kappa tagcloud1, Eta tagcloud7, Gamma tagcloud5)
Actual
  • Theta
  • Kappa
  • Eta
  • Gamma
The real-world shape: feed an ids expression that lists every keyword item, cap the cloud at the top 4 by count, label with the headline alias, weight by the numeric field. Against the 10-item Stable fixture the top 4 are Kappa 1000, Theta 255, Gamma 100, Eta 99; they render in fixture order Theta, Kappa, Eta, Gamma.
virtual{tagcloud:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0-5726c2c6b035d7aab450d1794e9e90d7::_#HEADLINE:_#NUMBER__}
Expected(ul.tagcloud with li.tagcloud6 Alpha, li.tagcloud3 Beta, li.tagcloud1 Gamma)
Actual
  • Alpha
  • Beta
  • Gamma
Three items (the Stable fixture: Alpha=14, Beta=42, Gamma=100). The count_field argument supplies each tag weight from the numeric field, the alias argument supplies the label. Tags appear in input order; the class is ranked by count, so Gamma (highest) gets tagcloud1, Beta tagcloud3, Alpha tagcloud6. HTML output, shown illustratively.
virtual{tagcloud:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0-5726c2c6b035d7aab450d1794e9e90d7::<span>_#HEADLINE</span>:_#NUMBER__}
Expected(li elements each holding span Alpha / span Beta / span Gamma)
Actual
  • Alpha
  • Beta
  • Gamma
The alias is any AA expression rendered per tag, so you can wrap each label in your own markup (here a span; an anchor with {go:} works the same). The class still comes from the count rank.
virtual{tagcloud:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0-5726c2c6b035d7aab450d1794e9e90d7-fb3df1343ef9a7d789af1f26aa5f8849-ae1da231f3e5bc16496834a0711aa042:3:_#HEADLINE:_#NUMBER__}
Expected(ul.tagcloud with li.tagcloud6 Gamma, li.tagcloud3 Theta, li.tagcloud1 Kappa)
Actual
  • Gamma
  • Theta
  • Kappa
Five items, count=3 keeps only the three highest counts (Kappa=1000, Theta=255, Gamma=100); Alpha and Beta drop out. The kept tags still appear in input order (Gamma, Theta, Kappa) with classes by rank: Kappa tagcloud1, Theta tagcloud3, Gamma tagcloud6.
test[{tagcloud:}]
Expected[]
Actual[]
With no item ids there is nothing to weight, so the command returns an empty string (the brackets are literal text around it). Same when count resolves to zero.
virtual{tagcloud:a65d19971986e750761f0efcd9a16b1b-4f3362a62847fe1f8c59ba28a92d42c0-5726c2c6b035d7aab450d1794e9e90d7:::_#NUMBER__}
Expected(three li elements all labelled with the literal text _#HEADLINK)
Actual
  • _#HEADLINK
  • _#HEADLINK
  • _#HEADLINK
Leaving the alias empty falls back to the documented default _#HEADLINK, an alias that does not exist on most slices (including this fixture), so every label prints the literal text _#HEADLINK. Always pass an alias that exists on your tag slice, such as its headline alias.
test[{tagcloud:notanid:::_#NUMBER__}]
Expected[]
Actual[]
A token that is not a real item id matches no items, so the cloud is empty. tagcloud never emits an empty ul - it returns nothing at all.