Could a client use the key
value to sort or prioritize Keywords in a given Category?
1 Answer
Yes, but Keyword Keys need to be unique within a Category and the entire BluePrint. Attempting to duplicate a Key (have separate Keywords share a Key) will prevent saving with:
Unable to save item Name, Key must all be unique for items of type: Keyword within this Category and its BluePrint context. Source or sources of conflict: tcm:1-6180-1024.
Keywords by default have:
- Value (Title)
- Description
- Key (non-localizable and must be unique)
Other ways to "sort" Keywords is by naming convention (like Structure Group navigation prefixes) or Keyword Metadata.
-
So you could have two keys with the same value/title, say (Key:Value) "GodAjax:Ajax" and "SportAjax:Ajax". Commented Oct 8, 2014 at 13:09
-
For the most-part, the challenge is 'to be unique within the blueprint'. If keys are used to map to something in the web app it can create a challenge when a child publication has already created a local keyword with a key you later decide to be required at the global/web-application level. This is were the discussion on naming conventions before-hand can come in (for example should local-keyword-keys be prefixed with some sort of quasi-unique id (.e.g dedeTheKey,esspTheKey) thus not stopping the parent site from later created 'TheKey'. If used for sorting then you have other considerations Commented Oct 8, 2014 at 22:58
-
@FrankvanPuffelen, yes but only in different Publications for a given Category where the Ajax with Key SportAjax is a different Keyword (not shared and the inherited Ajax is localized). In the same Category and Publication, I tried adding a Keyword with the same name as an existing Keyword, but with different Key and got the same error. Commented Oct 10, 2014 at 5:48
-
Slightly related, but I understand via the API we could have the same Keyword belong to two Keyword "parents" (doesn't show in the CME) or even two Categories. Commented Oct 10, 2014 at 5:49