Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to create global keys to be used across organization content?

Avatar

Avatar
Ignite 3
Employee
Kiran_Mohan
Employee

Likes

8 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Boost 5
Give Back 3
Boost 3
Boost 1
View profile

Avatar
Ignite 3
Employee
Kiran_Mohan
Employee

Likes

8 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Boost 5
Give Back 3
Boost 3
Boost 1
View profile
Kiran_Mohan
Employee

10-05-2021

Step 1: Create a global map for storing your keys.

  1. Create a map and add the keyref element to it.

 

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "technicalContent/dtd/map.dtd">
<map id="map.ditamap_ffbdbf06-8658-4311-ad84-1c631bba904f">
  <title>global-keys-map</title>
  <keydef keys="adobe">
    <topicmeta>
      <linktext>Adobe Systems</linktext>
    </topicmeta>
  </keydef>
  <keydef keys="AEM">
    <topicmeta>
      <linktext>Adobe Experience Manager</linktext>
    </topicmeta>
  </keydef>
</map>

 

 

  1. Here we have defined two definitions, as shown above, provided a keyref as “AEM” for the “Adobe Experience Manager” text.

Step 2: Add this global key map to your publication map.

  1. Now add this map to your publication map

 

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "technicalContent/dtd/map.dtd">
<map id="map.ditamap_cbf4a96d-e382-4e8c-8830-bcc093fe6638">
  <title>sample-map</title>
  <topicref href="sample-topic-using-the-keys.dita" type="topic">
  </topicref>
  <mapref format="ditamap" href="global-keys-map.ditamap" type="map">
  </mapref>
</map>

 

 

 

Step 3: Use the keys to refer to any of the variables defined in the global key map.

  1. Edit the topic and add the key value using the keyref.
  2. As shown in screenshot, a small window will appear from where keywords can be chosen. This will show when you add the “keyword” element.

Kiran_Mohan_0-1620655787187.png

 

 

Kiran_Mohan_1-1620655787192.png

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "technicalContent/dtd/topic.dtd">
<topic id="topic.dita_31b00e61-04b5-4193-af7a-68503e88b087">
  <title>sample-topic-using-the-keys</title>
  <shortdesc></shortdesc>
  <body>
    <p>This is a sample topic using the keys defined in the global map</p>
    <p>here i am using the key definition for AEM :<keyword keyref="AEM"></keyword></p>
  </body>
</topic>

 

 

 

 

 

 

authoring

Replies

Avatar

Avatar
Give Back 5
Employee
DivrajSingh
Employee

Likes

8 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Ignite 5
Boost 5
Boost 3
Ignite 3
View profile

Avatar
Give Back 5
Employee
DivrajSingh
Employee

Likes

8 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Ignite 5
Boost 5
Boost 3
Ignite 3
View profile
DivrajSingh
Employee

11-05-2021

@Kiran_Mohan : what are the general use cases where I should use keys or variables in DITA?

Avatar

Avatar
Ignite 3
Employee
Kiran_Mohan
Employee

Likes

8 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Boost 5
Give Back 3
Boost 3
Boost 1
View profile

Avatar
Ignite 3
Employee
Kiran_Mohan
Employee

Likes

8 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Boost 5
Give Back 3
Boost 3
Boost 1
View profile
Kiran_Mohan
Employee

11-05-2021

Hi @DivrajSingh , 

The most common use case - We should use keys and variables in cases where we have some text (maybe product name, company name, etc. ) that is used in many places and might change in the future. Also if there are topics that use different variable values in the context of some other publication then also it would be helpful.

Regards,

Kiran Mohan