Creating templates for a project

When a project administrator creates a new project, he or she can automatically inject content, such as a home page and any number of linked pages, into this project. The project administrator does this by selecting a project template at project creation time. Template designers can create project templates. CollabNet also provides a process-based template that supports application lifecycle management.

Project templates provide content and structure for a project. A template consists of a set of html files in the www/templates folder in the Subversion repository for the project-templates project.

For instance, you can configure a template for a project home page that provides links to all the critical documents in a project. When project owners configure a new project, they can select from among the templates in the project-templates project's trunk/www/templates folder. When a user creates a new project, the files in the template directory of the project-templates project are moved to the www directory for the new project. The new project's index.html file is replaced if an index.html was created in the templates folder, and the other template files from the project-templates project are also added to the www folder of the new project.

If you create a template, when a user creates a new project, the project creation page displays a Choose a Content Repository Template option. The template that you have created is presented as one of the options. The option name is based on a name that you provide in a template.properties file that resides in the www/templates folder.

About the template.properties file

In addition to creating the files that comprise the template, you must configure a template.properties file. The template.properties file must reside in the same folder as the new template. You must create template folders in your version control repository under the project-templates/trunk/www/templates folder, for example:

project-templates/trunk/www/templates/mytemplate

The following is a very simple template.properties file:

title=A pretty good template
description=This contains an index.html file with corporate branding and links to specification.html, mission_statement.html, and other project resources
active=true
ignore=template.properties

title - The name that is displayed on the project creation page. You can edit the name at any time and re-submit the file to the version control repository. If you do not supply a title, the folder name is displayed on the project creation page. For example:

title=empty

description - A short description of the template files. The description cannot contain line breaks. You can edit the name at any time and re-submit the file to the version control repository. This information is displayed on the project creation page. For example:

description=Default 'empty' project template

active - This can take a value of either true or false. This property must be set to true for the template to be available for selection during project creation. False is the default. For example:

active=true

ignore - You can exclude particular files and folders within the template folder from being published at the time of project creation. The property ignore: takes a set of file or folder names as a value. Separate names using a semicolon (;). The path should be relative to the template folder. For example:

ignore=template.properties; docs/changes.txt

Note: See the Help topic on editing the template.properties file through the user interface. For information about additional properties, please see the Help topic on the contents of the template.properties file.

Creating and enabling the templates

The following paragraphs describe how to create the contents of a template, and how to make the template available on the project creation page.

To add content to the project-templates project:

  1. Optionally, you can log in to the CollabNet environment, click the Projects tab, click the link for the project-templates project, and browse the contents of the version control repository for this project.
  2. Use your version control system to check out project-templates/trunk/www/templates.
  3. Create a folder for a new project template under the project-templates/trunk/www/templates folder, for example: project-templates/trunk/www/templates/mytemplate.
  4. Create html files in this folder.
    You can create a new index.html file and sub-folders if needed.
  5. Create a template.properties file directly under the template folder, for example: project-templates/trunk/www/templates/mytemplate/template.properties.
  6. Commit the template folder and files to the version control repository.

To enable project owners to use project templates:

  1. Log in as a domain administrator.
  2. Click the Administration tab.
  3. Click Configure > Domain in the left navigation pane.
  4. In the Enabled Functionality section, be sure Enable Project Templating is checked.
  5. Click Save Settings.
  6. If available, click Configure > Host in the left navigation pane.
  7. In the Enabled Functionality Across Site section, be sure Enable Project Templating is checked.
    Note that if this functionality is enabled at the host level, it is available to all projects in the domain.
  8. Click Save Settings.

Creating templates using project template archives

When you import a project template archive into a CollabNet site, it gets installed as a global project template in the project-templates project’s Subversion repository. You can then use this template when starting a new project. For further information on project template archives, please see the following Help files: