When AEM auto-generates IDs for elements, can you specify the element <title> in the "pattern for generating IDs field"? | Community
Skip to main content
Level 2
February 22, 2024
Solved

When AEM auto-generates IDs for elements, can you specify the element <title> in the "pattern for generating IDs field"?

  • February 22, 2024
  • 2 replies
  • 746 views

In my DITA XML docs, I want elements that have an auto-generated unique ID, but I also want the IDs to follow a format/pattern of  element<title>, followed by element name, and unique generated ID number (eg. <fig id="Toaster-Oven_fig_2">).

When configuring element id patterns in the Adobe Experience Manager Web Console Configuration page, can you specify the element <title> in the "pattern for generating IDs field"? The pattern is ${elementName}_${id}. Is it possible to specify the pattern: ${title}_{elementName}_${id}?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aanchal-sikka

Hello @davidl38471046 

 

This question is specific to DITA implementation. Requesting you to please raise under Experience Manager Guides - Adobe Experience League Community

 

You might be able to get quicker response there

2 replies

SureshDhulipudi
Community Advisor
Community Advisor
February 22, 2024

did you try writing a Sling model to generate ID in your pattern and include in HTL like below

 

sling model:

 

@Model(adaptables = Resource.class)
public class IDDModel {

private static int counter = 0;

public String getDynamicId() {
return "elementID_" + counter++;
}
}

 

<div data-sly-use.myModel="com.myproject.MyModel" id="${myModel.dynamicId}">
<!-- Component content -->
</div>

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
February 23, 2024

Hello @davidl38471046 

 

This question is specific to DITA implementation. Requesting you to please raise under Experience Manager Guides - Adobe Experience League Community

 

You might be able to get quicker response there

Aanchal Sikka