I see DXA code reading description field of a keyword component if it is available and not its name, I tried to look into the schema mapping to its model.. couldn't reach to the place where does this actually happen..

can anyone help me find it.. is it something which is DXA default feature ?

2 Answers 2


Here's what I see with reference to the Java project, you can find a similar class for .Net

See KeywordFieldConverter Class in dxa-tridion-provider, you will find that while getting Keyword's values in getStringValues they are picking the Keyword's Description by default, and if it's empty only then the title/name.

private List<String> getStringValues(List<Keyword> keywordValues) {
    final List<String> stringValues = new ArrayList<>();
    for (Keyword keyword : keywordValues) {
    return stringValues;


private String getKeywordDisplayText(Keyword keyword) {
    return Strings.isNullOrEmpty(keyword.getDescription()) ? keyword.getTitle() : keyword.getDescription();

I can relate to this blog More you know Tridion & Keywords to understand why it's recommended to use description and not key/title, it will surely save you trouble.


This behaviour is 'hardcoded' in the Model Mapping logic. Check out this line in Sdl.Web.Tridion.Mapping.DefaultModelBuilder:

string displayText = String.IsNullOrEmpty(keyword.Description) ? keyword.Title : keyword.Description;

The reason for this is that it is considered good practice to use keyword descriptions for display text. Often in implementations, the keyword title has a numeric prefix, or other additional information to ensure the keyword title is unique. Additionally some implementations leave the keyword title untranslated and put the localized value in the description.

As you can see from the code, if there is no description, the title is used, so you always have this fallback. What are you using descriptions for if its not display text?

  • Cool... it solves my problem. ahh ! its a client requirement and i guess i need to convince them not to break the law of standard practices. Thanks Will. :) Commented Feb 15, 2016 at 10:10
  • The description is getting used to specify company name which has recently acquired the client. Earlier they were only using title so this was not encountered. Commented Feb 15, 2016 at 19:23
  • @VikasKumar sounds like they should use Keyword Metadata for that, as it is incorrect usage of a description (typical case of metadata I would say). Commented Feb 17, 2016 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.