Master directive(file) Last updated: 10. Jan 2023

This is used for specifying a master file to use as template for the page. By using XDT attributes you can swap, remove and insert content into the specificed master file.

Parameters

Name Type Description
file string Absolute file path (from the site root) to the specified file to use as master page.

Returns

Merges the page into the specified master page template.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
<!--#master file="master.hash"-->
<html>
    <body>
        <section id="Content" xdt:Transform="Replace">
            Page content.
        </section>
    </body>
</html>

Output

The #JS code above produces the output shown below:
<html>
    <head>
        <title>Header contents from master.hash</title>
    </head>
    <body>
        <header>Example contents from master.hash</header>
        <section id="Content">
            Page content.
        </section>
        <footer>Example contents from master.hash</footer>
    </body>
</html>