Docly Developers
Function Updated 26 Oct 2026

Include directive(file)

Inserts the output of another file into the page. Use it for markup shared by many pages, such as a header, a footer or a navigation menu.

The directive is processed after the page's own code has run. The included file is rendered on its own: a .hash file runs its own code and cannot see variables declared in the including page, a .docly document is rendered with its schema's display template, and other files are inserted as they are (their own directives are still processed). Included files may include other files.

Directives are processed in pages and templates only — not in #/API files.

Parameters

filestringrequired

Path to the file in double quotes, resolved from the site root — a leading / is optional, so "Header.hash" and "/Header.hash" are the same file. Paths are not relative to the current page's folder. A path starting with #/ falls back to the site template's file when the site has no own copy.

Returns

The rendered contents of the file. If the file is not found, the text INCLUDE ERROR, FILE NOT FOUND: … is written to the page instead.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
<html>
    <body>
        <!--#include file="Header.hash"-->
        <section>
            Page content.
        </section>
        <!--#include file="Footer.hash"-->
    </body>
</html>