Movable Type Documentation

« Output file | Up | Template body »

Chapter Templates

Linked templates

This field contains the path to the linked file for a particular template.

Some users will find it easier to edit the template layouts in a text editor like BBEdit or a web page editor like Adobe Go Live instead of the Movable Type browser interface. You can optionally link a Movable Type template to an external file. This allows you to edit your templates while keeping the copy that is inside Movable Type synchronized with the external file.

In the field labeled "Link this template to a file" on the New/Edit Template screen, enter either a full path to your external file, or a path relative to the Local Site Path. For security purposes, the file extension cannot be .cgi, .pm, .pl, or .cfg. This is to avoid the potential of overwriting Movable Type program files and corrupting the system. When you save the template the files will be linked.

The synchronization process works in both directions. When you load a template for editing, the date of the linked file is checked, and the template is updated if the linked file date is more recent. When you save a template through the Movable Type CMS, the linked file is updated with your changes.

When you create a new template without specifying a template body, and link it to a file that already exists, the contents of that file will be pulled in to the template. If you do specify a template body, however, and the linked file already exists, that linked file will be overwritten with the template body you specified.

For instance, if you would like to maintain your Main Index template with an external editor, you would first set the linked file field to something like index.html.tmpl and click the "Save" action button. You can then edit this file externally. The next time you rebuild, Movable Type will read in the latest version of the linked file index.html.tmpl and use that as the template body. During this process it will also update the copy of the template in the Movable Type database, so that the next time it needs the template it can use the version in the database.

Another added benefit to linking a template to an external file is that you can synchronize templates across multiple weblogs. This is particularly helpful when you have multiple weblogs that require the same layout.

To do this, link all of the source weblog's templates to file. This creates external files of all the template you want to share. Then go into the other weblogs and link their templates to the files created by the first one. When you rebuild those weblogs they will now have the same templates.

For relative file paths, the root is typically the MT directory, but this can vary in particular server environments so we recommend specifying a full path (i.e. starting with a slash '/') for this field.

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Support.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.