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¶
Older builds stored domain tags inside the main subreddit config as domainTags: DomainTag[] on the toolbox-nxg page. On the first read of the dedicated domain-tags page, NXG automatically migrates any tags found there:
Reads
ToolboxConfig.domainTagsfrom the existing config.Creates a new
toolbox-nxg/domain-tagspage seeded with those tags (approvalCount: 0,removalCount: 0).Removes
domainTagsfrom the config page and saves.
After migration the domainTags field is absent from the config page permanently.
Schema reference¶
Top-level page object (DomainTagsData)¶
{
"ver": 1,
"showCounts": false,
"tags": [ ... ]
}
Field |
Type |
Description |
|---|---|---|
|
integer |
Schema version; currently |
|
boolean |
When |
|
|
The list of domain tag entries for this subreddit |
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 |
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.
The first matching tag wins. 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. 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.