Docly Developers
Function Updated 11 Aug 2026

getTags(path)

Returns the tags stored on a document.

Tags share their storage with the full text search index, so they are always stored — and returned — as lower case single words. See addTag for what that does to a tag on the way in.

Parameters

pathstringrequired

Path to the document, from the site root. This is the published path, so it follows the same rules as a link: a schema-bound document is addressed without its .docly extension, while a schemaless document keeps its .json. Passing "/Invoices/Invoice 1001.docly" throws File not found; "/Invoices/Invoice 1001" is correct. The leading slash is optional.

Returns

An array of strings — the document's tags, always in lower case. An empty array if the document has no tags, never null.

Throws an error if the path is empty, if it contains .. or a backslash, or if the file is not found. The error message names the path, so a loop that tags many files tells you which one failed.

Unlike addTag and removeTag, this function is not restricted to the API folder — the tags of a published file are already readable through listFiles and getFiles.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    /* Note the path: no .docly extension on a schema-bound document */
    let tags = docly.getTags("/Invoices/Invoice 1001");

    write("Number of tags: " + tags.length);

    for (let tag of tags)
    {
        write(chr(13) + " - " + tag);
    }
}#