primitive · constellation

<atproto-generic-count>

Count primitive for arbitrary subject + source. Build custom badges for any lexicon without forking the library.

Likes:

Followers:

<atproto-generic-count
  subject="at://did:plc:.../com.example.recipe.collection/abc"
  source="com.example.recipe.ingredient:usedIn.uri"
  label="recipes use this">
</atproto-generic-count>
NameTypeDefaultDescription
subject * string AT-URI, DID, or any backlink target.
source * string 'collection:path' format. Path uses no leading dot — e.g. 'app.bsky.feed.like:subject.uri'.
label string Suffix label after the count (e.g. 'likes', 'mentions').
constellation string Override the Constellation endpoint.

External CSS can target these via atproto-generic-count::part(<name>) { ... }.

PartWhat it is
count / number / labelOuter span, numeric value, and optional label suffix.

The library ships named-interaction components (<atproto-like-count>, <atproto-likers>, etc.) for the common Bluesky cases. Those bake in known collection:path pairs from the SOURCES table.

The moment you want a count for a custom lexicon or a less-common relation (mentions via app.bsky.feed.post:facets[].features[].did, say, or com.example.recipe.review:subject.uri), the named components don't fit. This one does — pass any subject + any source and you get a count.

Custom lexicon adoption badge

<p>
  This recipe is referenced by
  <atproto-generic-count
    subject="at://did/com.example.recipe.recipe/abc"
    source="com.example.recipe.collection:recipes.uri"
    label="cookbooks">
  </atproto-generic-count>.
</p>

Discover what to count

Not sure what source to pass? Render <atproto-backlinks> against your target first — it shows every collection:path that references the subject, with counts. Pick the one you want and paste it into <atproto-generic-count>.

<atproto-backlinks> for the full backlinks map. <atproto-like-count> is this component hardcoded to the like source. The SOURCES export (source) lists the well-known shapes.