Creating map templates that automatically generate topics

You can create a map template that automatically generates topics when a users creates a map from the template.

While it is not a good idea to include references to existing topics in a map template, you might want to generate new topics of a certain type when you generate a new map from a template. Using topic stubs, you can create map templates that also generate new topics.

To add topic stubs to a map, add the @xtrc="generate" attribute to the <topicref>.

For example, in this map template

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//ACME//DTD DITA Map//EN" "AcmeMap.dtd">
<map id="{{ixia.id}}" xml:lang="{{ixia.xml:lang}}">
	<title>{{ixia.title}}</title>
	<topicref navtitle="About this document" type="concept.xml" xtrc="generate"/>
	<topicref navtitle="Requirements" type="concept.xml"/>
</map>

There are two topic stubs. The first uses the concept.xml template to generate a new topic using that template with the title About this document. The second also uses the concept.xml template to generate a new topic with the title Requirements.

As a result, when the new map is generated from this template, it already contains two topics. Those topics have whatever structure and content is specified by the concept.xml template.

Location of topic templates

The @type attribute in the <topicref> element must refer to a topic template. If the value of the attribute is simply the template name, the CCMS assumes the template is stored in the system/templates/topic folder of the Content Store.

If your topic templates are organized into subfolders, you must also specify the subfolder structure in the @type attribute. For example, consider the following structure in the Content Store:

Topic template structure
Specify templates from this structure as follows:
  • To use the Release_Notes_Templates.xml template for a topic stub, you can include just the template name, as this template is in system/templates/topic:
    type="Release_Notes_Templates.xml"
  • To use the Rest API Data Structure.xml template for a topic stub, you must include the REST API folder in the @type attribute, as this template is in that subfolder:
    type="REST API/Rest API Data Structure.xml"
  • To use the concept.xml template for a topic stub, you must include the Technical Content folder in the @type attribute, as this template is in that subfolder:
    type="Technical Content/concept.xml"