Docly Developers
Function Updated 26 Nov 2026

getPages(path, [options])

Returns the pages in a folder, for building menus and listings: one entry for each subfolder that has an index page, followed by the files. Folders the user has no website (Visit) access to are left out. Access is checked for the signed-in visitor in an API script (/API/), and for the user who published the site everywhere else — on a page, and in an API script nobody is signed in to. Pass access: 'publisher' to check access for the publisher in an API script too — for an app that lets Docly handle sign-in and decides permissions itself (see Let Docly handle login, you handle the permissions). A page is cached and shared by every visitor, so on a page the list is the same for everyone.

Parameters

pathstringrequired

Folder path from the site root. An empty string means the site root.

optionsobjectoptional
Specify any of the following options parameters:
searchPatternstring

Wildcard for folder and file names. Left out, every file is listed. With "*" only .html, .docly and .hash files are listed.

depthnumber

How many levels of subfolders to include, default 0 (only the folder itself).

modeStrstring

Detail level, as for getFiles: "Full" (default), "Medium", "Min" or "Json". The name is modeStr when you use the options-object syntax.

accessstring

Whose access the list follows. Leave it out for the default: the signed-in visitor in an API script, the publisher everywhere else. 'publisher' lists with the publisher's access in an API script too — use it when your script checks permissions itself, for example looking up a record anywhere in the site and then deciding from its own user registry. It is the publisher's access, not everything: folders the publisher is denied, # folders and tool folders are still left out. Any other value throws an error.

Returns

An array of page objects with the same fields as getFiles. For a subfolder, the entry is its index page (index.docly, index.hash or index.html) with filename set to the folder name, file set to false and Title defaulting to the folder name; subfolders without an index page are left out.

index.* files, .old files and folder properties files are never listed as files, and # folders and everything in them are never listed. An unknown folder gives an empty array; a path containing .. or a backslash gives null.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// A simple menu from the pages in the site root
let pages = docly.getPages("", "*");

for (let p of pages)
    write('<a href="' + p.Url + '">' + docly.htmlEncode(p.Title) + '</a>\n');