Creating Custom Templates – Antetype 1.3

The new template chooser in Antetype 1.3 comes with predefined templates but it possible to add custom templates to the template chooser too.

This post will take you through the process of adding a new custom template to Antetype.

Location of templates

All templates are held in the Application Support directory for Antetype – the path for this directory is:

~/Library/Application Support/com.antetype/Templates

or if you are using the App Store build:

~/Library/Containers/com.antetype.Antetype-App-Store/Data/Library/Application Support/com.antetype.Antetype-App-Store/Templates 

or if you are using the BETA build:

~/Library/Application Support/com.antetype.Antetype-BETA/Templates 

Default contents of Templates folder

By default inside the Templates directory are a number of folders prefixed with ‘default-‘ these folders are used for the standard templates. There is also a file called AntetypeTemplateDetails.plist – do not edit this file as it used when updating templates.

This directory is created the first time Antetype 1.3 is run so if you cannot find it please ensure that you have started Antetype 1.3 automatically.

Adding a new category

If you look into the default-gettingStarted folder you will see the details of a category.

Contents of Getting Started folder

The most important part of a category is the ‘template-category.plist’ this file is where the display name of the category is set along with any notes for the category.

xml version="1.0" encoding="UTF-8"?>


    
        category-title
        Getting Started
        category-notes
        
    

For example the category-notes field is used in the Android and Microsoft categories to highlight that the templates require certain fonts to display properly.

So to create a new category first create a folder in the Templates folder called ‘My Templates’.

Inside this folder copy the ‘template-category.plist’ file from default-gettingStarted and edit the category-title from ‘Getting Started’ to ‘My Templates’. Your edited plist should look like:

xml version="1.0" encoding="UTF-8"?>


    
        category-title
        My Templates
        category-notes
        
    

If you restart Antetype you will now see your empty category in the template chooser.

Adding a new template

Going back to the default-gettingStarted you will notice that there are three files with the prefix gettingstarted-Tutorial1:

  • gettingstarted-Tutorial1-thumb.png
  • gettingstarted-Tutorial1.atype
  • gettingstarted-Tutorial1.plist

These are the three files that are needed to add a template to your new Category.

The png file is a the image that will be displayed in the template chooser for your template – this can have whatever content you wish in it to best show the contents of your template.

The atype file is your template – this file will be copied and opened as a new document when a user selects a template.

The plist file is where you set the name of the template and any notes about the tutorial to appear in the tooltip in the template chooser. The format of the plist is:

xml version="1.0" encoding="UTF-8"?>


    
        template-name
        Getting Started
        template-notes
        This template contains a interactive tutorial
    

So to add a new template to your category you will need a png file and an atype file as the basis of your template – please set their names to have a matching prefix as shown above.

Then create a plist file with the same prefix as the atype and png file.

The contents of your plist should look something like:

xml version="1.0" encoding="UTF-8"?>


    
        template-name
        My First Template
        template-notes
        This template is amazingly useful
    

Now restart Antetype and you will see your template inside your template category. Double click on the template to create a new document based on it.

Adding screen templates

Documents that have been created from a particular template category can have a custom menu configured for the new screen toolbar button.

The Getting Started category doesn’t offer a custom new screen menu so we will need to look in another template folder to understand this better. Let’s look into the ‘default-ios7Phone’ folder where you should find a screens.atype.

The screens.atype file is a normal Antetype file. The screens held in this file are used to populate the New Screen toolbar menu. The screen names become the menu names and an image of the screen is used as the image on the left.

To customise the New Screen menu for your category just add an Antetype file to the category folder and rename it screens.atype. If you restart Antetype you will see your custom New Screen menu is available for all documents created from templates in your category.

Tip: When a document is created from a template Antetype stores the template-code (which is the folder name) inside the document. If you change the name of your category folder in Templates you will find that older documents no longer have any entries in the New Screen Menu.

This post is part of a series of posts about Antetype 1.3.

One Response to Creating Custom Templates – Antetype 1.3

Leave a Reply