Docly Developers
Function Updated 26 Oct 2026

Include(path, [template])

Include a file or template into another page.

include2 is an internal variant used while rendering included documents — do not call it yourself.

Parameters

pathstringrequired

Absolute path of file to include.

templatestringoptional

If referring to a Docly document with a schema that include templates.
You can specify what template it should generate.

Returns

The file's content — for a file with #JS code, the executed result. With a template, the document generated through that template, or the generator's error message if generation fails.

If the file is not found, the text Unknown file <path> is returned (no error is thrown). A file that includes itself, directly or through other files, is stopped with the text Infinite include loop stopped for …. The same file can still be included several times on one page.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        #include("#/Test-header.html")#
        <article>
            Content here ...
            #include("Frontpage", "Article.html")#
        </article>
        #include("#/Test-footer.html")#
    </body>
</html>