Docly Developers
Function Updated 25 Oct 2026

getAllTags(path, [options])

Returns every distinct tag in use in a folder — the list you need to fill a tag picker, an autocomplete or a filter menu.

The values it returns are exactly the values the tag filter on listFiles and getFiles matches, because both are the normalized stored form of the tag. That is what makes the pair useful together: this function tells you what is worth filtering on, the filter then narrows to it.

Parameters

pathstringrequired

Folder path, from the site root. Pass "/" for the whole workspace. The leading slash is optional.

optionsobjectoptional
Specify any of the following options parameters:
recursivebool

Include documents in every subfolder. Default false, which considers only the documents directly in the folder.

Returns

An array of distinct tag words, lower case and sorted alphabetically. An empty array when nothing in the folder is tagged — never null.

The sorting is done for you on purpose. The list is normally rendered straight into a dropdown, and the order is meaningful to a reader. (docly.sort() needs a field name, but a plain tags.sort() works if you want another order.)

A folder that does not exist yields an empty array, not an error — the same convention as listFiles and getFiles. A mistyped path is therefore indistinguishable from an untagged folder, so check the path first when a picker comes up empty.

Throws an error if the path is empty or contains .. or a backslash.

Like getTags, this function is not restricted to the API folder. Tags from folders the site's publisher has no website (Visit) access to, and from # folders below the folder you asked for, are left out — the files they belong to are left out of listFiles and getFiles too. Access is that of the user who published the site — the user the site runs as — not of the visitor, so the result is the same for everyone. To tailor a list to the signed-in visitor in an API script, check each item with allowVisit.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    /* Every tag used anywhere in the workspace */
    let tags = docly.getAllTags("/", { recursive: true });

    write("<select name=\"tag\">");
    for (let tag of tags)
    {
        write("<option>" + tag + "</option>");
    }
    write("</select>");
}#