Under maintenance

Heretto Help

Show Page Sections

Variable Reuse with Keyrefs

You can reuse variables from variable warehouse maps with keyref attributes.

Overview

This example shows that:
  • The “Warehouse Map” is added to the deliverable “Map A” through the mapref element with the @processing-role="resource-only" attribute assigned.
  • “Variable A” is used in “Element A” in “Topic A”.
  • “Variable B” is used in “Element A” and in “Element D”. The elements are in different topics.
Reusing variables with keyrefs

Example

The following example shows the variable reuse mechanism through keyref attributes in Heretto CCMS. The Content Editor indicates reused variables with a key icon and a gray background.

Figure 1. Variable Reuse Example.
The following example shows that:
  • The companyName variable is used in “Topic A”
  • The productName variable is used in “Topic A” and “Topic B”
  • The variables are reused from “Variable Warehouse Map” through keyref attributes and keyword elements
Reusing variables with keys

Create a Warehouse Map with Keyrefs

Create a variable warehouse map that contains variables for product names, interface names, etc.

Tip:

We recommend grouping similar variables in dedicated variable warehouses. For example, keep your product name variables and interface variables in separate variable warehouses. This strategy prevents your variable warehouses from becoming very large, cluttered, and disorganized as you add new reusable elements over time.

  1. In the Content Library, navigate to the folder where you want to create the variable warehouse map.
    Tip:

    We recommend creating variable warehouses in a dedicated folder, for example _variables in the _Global_Shared folder. Keeping variable warehouses in one place, makes it easy to find and update reusable content.

  2. Create a variable warehouse map by doing the following:
    1. Click Create New > Map.
    2. In the Title field, enter a meaningful name for the variable warehouse map.
      Enter Interface Variables

      .

    3. Click Create & Edit.
  3. Add a variable to the variable warehouse map by doing the following:
    1. In the Map Editor, right-click the map title (not the <title> tag) and select Append element > keydef.
    2. In the Required Properties dialog, in the Keys field, enter a key name and click Save.
    3. Right-click <keydef> and select Append element > topicmeta.
    4. Right-click <topicmeta> and select Append element > keywords.
    5. Right-click <keywords> and select Append element > keyword.
    6. Right-click the map title and select Edit element XML.
    7. Change <keyword/> to <keyword></keyword> by removing the forward slash character.
    8. Enter the text that you want to display for that keyword.
      <keyword>Displayed Name</keyword>
  4. If needed, add more keywords by doing any of the following:
    • Repeat 3.
    • Copy, paste, and edit an existing keydef element in the Source Editor.
  5. Click Save.
Add the variable warehouse map to a deliverable map. See Add a Warehouse Map with Keyrefs to a Deliverable Map.

Add a Warehouse Map with Keyrefs to a Deliverable Map

Add a variable warehouse map to a deliverable map to enable variable reuse through keyword elements and keyref attributes.

Note:

If you do not want to add your warehouse maps to your deliverable maps, you can skip this procedure and set your warehouse maps as context maps. See Set a Context Map.

Create a variable warehouse map and define variables. See Create a Warehouse Map with Keyrefs.
  1. In the Content Library, double-click a map to open it in the Content Editor.
  2. In the Content Editor, click Open Library.
  3. In the Content Library, navigate to the variable warehouse map that you want to add to the deliverable map.
  4. Drag and drop the variable warehouse map from the Content Library into the Map Editor.
    Tip:

    A line appears that indicates where the component will be added. If you drop a component on another component, a green box appears. The green box indicates that the new component will be added as a child of the component that is already in the map.

  5. In the Map Editor, click Edit element properties for the variable warehouse map.
  6. In the Edit Properties window, from the processing-role drop-down menu, select resource-only.
Figure 2. Appended Variable Warehouse Map
Reuse variables in the deliverable map. See Reuse Variables through Keyrefs.

Reuse Variables through Keyrefs

You reuse variables from the variable warehouse maps through keyword elements and keyref attributes.

Add a variable warehouse map to a deliverable map. See Add a Warehouse Map with Keyrefs to a Deliverable Map.
  1. Open a map with a topic in which you want to reuse a variable.
  2. Navigate to the topic in which you want to insert the variable.
  3. Place your cursor where you want to insert the variable.
  4. Open the Con/Keyref drop-down menu by pressing Cmd > Shift > K (Mac) or Ctrl > Shift > K (Windows).
  5. Do any of the following:
    • Begin entering the variable @keys attribute value.

      Heretto CCMS automatically highlights the closest match.

    • Find the variable by browsing the list.
  6. Use your keyboard keys or mouse to select and insert a variable.