removeTag(path, tag) Last updated: 10. Aug 2026
API only function
Removes a tag from a document without touching its other tags.
The counterpart of addTag, and incremental for the same reason: only the tag you name is deleted, so a script running next to yours does not lose the tags it just added.
See also: addTag getTags Tags are stored as search words
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | Absolute path to the file, from the site root. |
| tag | string | The tag to remove. Normalized the same way it was when it was stored, so the casing you pass in does not matter. A value of several words removes every word in it. |
Returns
An array of strings — the document's tags after the operation.
Removing a tag the document does not have is not an error. The end state is the one you asked for and the list comes back unchanged, so the call is safe to repeat.
Throws an error if the path or the tag is empty, if the path contains .. or a backslash, if the file is not found, or if you do not have edit access to the document.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Remove one tag. The document's other tags are left alone.
var tags = docly.removeTag("Invoices/Invoice 1001.docly", "Paid");
// -> ["invoice", "2024"]
// Removing a tag that is not there is not an error.
docly.removeTag("Invoices/Invoice 1001.docly", "unpaid");
// -> ["invoice", "2024"] - unchanged
// A tag of several words was stored as one tag per word,
// and is removed the same way - both words go.
docly.removeTag("Reports/Report 2024.docly", "Annual report");
// Retag without a read-modify-write of the whole list
docly.removeTag("Invoices/Invoice 1001.docly", "draft");
docly.addTag("Invoices/Invoice 1001.docly", "approved");