Scriptlet Examples


Showing text on HTML export only

If you'd like for certain content to be shown on HTML export, but not on PDF export, you can write a scriptlet like this:


<% if (writer.contextType() == "html") { %>

This rich text will be shown only on HTML export!

<% } %>



Listing the aliases for a page

You can grab the aliases for a page, and then loop through them like so:


<%

var aliases = page.aliasDisplayNames();


for (i = 0; i < aliases.count(); i++) {

    var name =  aliases[i]; 

    writer.write(name + "<br/>");

}

%>