Tutorials » Creating a custom template

To create your own templates you will need to have some knowledge of how HTML works.

Step 1

Create a chunk based on following code and note its name. This document will assume you named it DittoTemplate.

Default display template (tpl):

<div class="ditto_item" id="ditto_item_[+id+]"> <h3 class="ditto_pageTitle"><a href="[~[+id+]~]">[+pagetitle+]</a></h3> <div class="ditto_documentInfo">by <strong>[+author+]</strong> on [+date+]</div> <div class="ditto_introText">[+introtext+]</div> </div>

Available placeholders

  • Any document object or template variable in the format of [+documentobject+]
  • [+url+] - URL of the item
  • [+author+] - Author of the item

Step 2

Append &tpl=`DittoTemplate` to your snippet call and Ditto will use your custom template

Note

&tpl can take three kinds of values:

  1. If the value does not begin with "@CODE" or "@FILE" then it is interpreted as the name of a chunk which contains the desired template.
  2. If the value begins with "@FILE", then it is interpreted as the pathname of a file which contains the desired template.
  3. If the value begins with "@CODE", then the value is interpreted as the template itself; right there in the snippet call.