Docly Developers
GuideUpdated 18 Oct 2026

Load data from other documents

Use this example to load data from other Docly files and bind / insert values into another document.

Loading data from files / documents

<div>
    <!-- Get data from other page (file or document type) -->
    #let p = docly.getFile("filepath/filename")#

    #if (p) {#
    <!-- Bind data to page, read from variable "p". Hash expressions do not escape HTML, so encode the values: -->
    #docly.htmlEncode(p.Fieldname1)#
    #docly.htmlEncode(p.Fieldname2)#
    #}#
</div>

Inserting an image

<div>
    <!-- Get data from other page (file or document type) -->
    #let p = docly.getFile("filepath/filename")#
    
    <!-- Pass the file object first: linkImage prepends p.Url for you -->
    <img src="#docly.linkImage(p, p.FileField1, 1024, 768, 1, 'virtual-name.jpg')#" alt="An image" />
</div>

Inserting a download link to a file

<div>
    <!-- Get data from other page (file or document type) -->
    #let p = docly.getFile("filepath/filename")#
    
    <!-- Same for a non-image file: linkFile takes the file object first too -->
    <a href="#docly.linkFile(p, p.FileField1, 'Virtual-name.txt')#" download>Download file</a>
</div>