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
pathstringrequiredFolder path from the site root. An empty string means the site root.
optionsobjectoptionalsearchPatternstringWildcard for folder and file names. Left out, every file is listed. With "*" only .html, .docly and .hash files are listed.
depthnumberHow many levels of subfolders to include, default 0 (only the folder itself).
modeStrstringDetail level, as for getFiles: "Full" (default), "Medium", "Min" or "Json". The name is modeStr when you use the options-object syntax.
accessstringWhose 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
// 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');<a href="/Blog/Index">Index.hash</a>
<a href="/Getting-Started">Getting Started</a>
<a href="/Introduction">Introduction</a>