6

I am trying to create a tree structure of keywords but Tridion is not allowing me to create same child keywords under two different parent keywords.For e.g

Country  
   India  
      abc  
   China  
      abc  

Here both India and China are keywords inside country and both the countries have a province name abc. I am not able to assign same child keyword (both key and value) under different countries Is there a work around or i have to use description text for identifying the value

0

3 Answers 3

3

This should be the expected behaviour. AFAIK you can not have same name keywords in a Single Category. Just imagine in case this might have been allowed, if you attach this category to a schema, then while creating component, how do you recognize which keyword to use

2
  • Thanks Pankaj, you are correct, but putting my question other way, this requirement scenario is highly possible so just want to confirm is it a right way to use description text for putting the actual value? Mar 12, 2014 at 7:44
  • 1
    To Answer in simple words - No. You may think of utilizing the Description field of the keyword Mar 12, 2014 at 7:45
1

Internally Tridion actually stores keywords linearly within a Category and uses a parent reference attribute to create a hierarchical view. That's why you can't have the same kw names.

I ran into this problem when populating a Category of Geographical locations, e.g. Country->State->City. There are cities by the same name in multiple countries and states.

The simple way to solve this is to prefix or suffix the keyword with something. In my case the city was suffixed with a state code (e.g. "Springfield, MA", "Springfield, IL").

So ask your content/taxonomy authors to be creative with the labels. If that option won't work, than you may need to separate your hierarchy into separate Categories with unique Keywords names in each.

4
  • Thanks Nickoli, but state code is not available in my case and if i create separate category for each country that will create a lot of categories. I want to use this list in metadata of a component from where i can select a city. In this case i will be able to assign only one category to schema of that component. Mar 12, 2014 at 16:23
  • No sure what you mean by "not available". You know what the parent kw is when you create the child. In your specific example you'd have the child keywords with the following titles: "abc, in" and "abc, cn". Mar 12, 2014 at 16:46
  • By not available, I mean I do not have code for the states. Beside this if i use "abc,in" then i will have to trim the later part ",in" from each kw while using it from CD side (will be using DD4T to retrieve the keywords from broker) as i want only "abc" part of the whole keyword. Is it ok to do it that way? Mar 13, 2014 at 4:23
  • You can use any suffix so long as it keeps the values distinct. Have your template code strip this out - example: Country India abc [india] China abc [china] The code strips anything (and including) after <space>[ Alrernatively you could keep it a flat structure (although it may become cumbersome with a large list) Country - Locale ... India - abc ... China - abc May 5, 2015 at 19:19
0

Added as an answer as cannot format otherwise....

You can use any suffix so long as it keeps the values distinct. Have your template code strip this out - example:

Country  
   India  
      abc [india]
   China  
      abc [china]

The code strips anything (and including) after <space>[

Alrernatively you could keep it a flat structure (although it may become cumbersome with a large list)

Country - Locale
    ...
    India - abc
    India - def
    ...
    China - abc
    China - ghi
    China - xyz

Your Answer

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

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