Domain Tags Schema¶
Domain tags let moderators color-code links by domain so the source of a submission is visible at a glance. Each subreddit’s tags are stored on a dedicated wiki page separate from the main config, giving cleaner audit history when tags are added or updated.
Wiki page (NXG layout) |
Classic layout |
|---|---|
|
(embedded in |
The page is restricted to moderator-only access (permlevel: 2).
Migration from config¶
Toolbox 6.x stores domain tags inline on the classic toolbox config page as domainTags. When a moderator first reads the dedicated domain-tags page and it does not exist yet, NXG creates it, seeded with those tags (approvalCount: 0, removalCount: 0). The tags are read from the toolbox page’s revision history (the newest revision carrying any), not its current content: with 6.x compatibility on, NXG rewrites that page from its own data, and turning compatibility off replaces it with a tombstone.
With 6.x compatibility on, NXG writes the tags back into the classic toolbox page’s domainTags array whenever the tags are edited (and on every config mirror write), keeping only name, color, and note (6.x has no counts or thresholds).
Early builds created the page empty instead. A one-time repair restores those tags the same way, but only into a page that is still untouched (a single revision and no tags); either way it records legacyDomainTags in repairs so it never runs again.
Schema reference¶
Top-level page object (DomainTagsData)¶
{
"ver": 1,
"showCounts": false,
"tags": [ ... ],
"repairs": ["legacyDomainTags"]
}
Field |
Type |
Description |
|---|---|---|
|
integer |
Schema version; currently |
|
boolean |
When |
|
|
The list of domain tag entries for this subreddit |
|
|
Optional. One-time data repairs already applied (currently only |
DomainTag¶
{
"name": "*.blogspot.com",
"color": "#ff6600",
"note": "Blog network; check individually",
"approvalCount": 12,
"removalCount": 47,
"removalThreshold": 70
}
Field |
Required |
Type |
Description |
|---|---|---|---|
|
yes |
string |
Domain pattern to match (see Pattern matching) |
|
yes |
string |
CSS color applied to the indicator, e.g. |
|
no |
string |
Optional free-text note displayed in the tag popup and as a tooltip on the indicator |
|
yes |
integer |
Cumulative number of approvals of posts from this domain in this subreddit; |
|
yes |
integer |
Cumulative number of removals of posts from this domain in this subreddit; |
|
no |
integer |
Removal-rate alert threshold (0–100). When |
On read, entries without a non-empty string name are dropped, a missing or empty color defaults to #cee3f8, counts are coerced to non-negative integers (0 when absent or invalid), and a removalThreshold outside 0–100 or a non-string note is removed.
Note
approvalCount and removalCount are managed entirely by the extension. External tools that round-trip this page should preserve the existing values unchanged rather than resetting them to 0.
Pattern matching¶
The name field on a DomainTag is matched against the domain of an incoming post URL. Three matching strategies are tried in priority order:
Exact —
namematches the domain exactly, e.g.i.imgur.com.Glob —
namecontains*, which matches any sequence of characters, e.g.*.blogspot.commatchesfoo.blogspot.combut notblogspot.net.Suffix —
namewithout*is checked as a domain suffix, e.g.imgur.commatchesi.imgur.comandm.imgur.com.
An exact match anywhere in the list wins; otherwise the first glob match in list order, then the first suffix match. A tag whose name starts with www. also matches the same domain without www. exactly (not its subdomains), since lookup domains are www-normalized. To prevent a suffix match from firing on a specific subdomain, add a more-specific exact-match entry for that subdomain.
Approval/removal tracking¶
Whenever a moderator approves or removes a post, the extension looks up the post’s domain against the subreddit’s tag list and increments the matching tag’s approvalCount or removalCount. Writes are queued (one write per subreddit at a time) to avoid concurrent edit conflicts on the wiki page.
The counts are never reset automatically. They can be cleared manually by editing the wiki page directly, or the field can simply be set back to 0.
Alert threshold¶
When a tag has removalThreshold set, the indicator color changes to a warning orange (#ff6600) whenever the removal rate meets or exceeds the threshold:
removalCount / (approvalCount + removalCount) >= removalThreshold / 100
The threshold has no effect when both counts are 0.
Versioning¶
ver selects the schema version. The only currently defined version is 1; a missing ver is treated as 1. NXG refuses to read or overwrite a page whose ver is outside the range it supports. Future schema changes will bump this value and may add a migration step in the codec.
Interoperability notes¶
Preserve unknown fields. If your tool reads and writes this page, carry forward any fields it does not recognize so that future schema additions survive the round-trip.
Do not write approvalCount / removalCount from external tools. These fields reflect in-extension mod activity and are managed exclusively by the extension. Overwriting them with computed or estimated values may produce misleading indicator behavior.
Import strips counts. When a moderator imports tags from another subreddit using the toolbox settings UI, only name, color, and note are carried over. Counts start at 0 in the destination subreddit.