Docly Developers
Function Updated 25 Oct 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 site's publisher has no website (Visit) access to are left out. 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.

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.

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');