Docly Developers
Function Updated 17 Oct 2026

load(file)

Loads a file from the site, runs the #JS code it contains and returns the result as text.

See also Include getJson

Parameters

filestringrequired

Path to the file, from the site root.

Returns

The processed content as a string. null when the path is empty, and the text Load failed for '<path>' when the file does not exist.

A file that loads itself, directly or through other files, is stopped with the text Infinite loop stopped for ….

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// Render a shared snippet and use the result
let footer = docly.load("#/Snippets/footer.hash");
write(footer);