3

When viewing something published with DXA and a nested Keyword structure, is doesn’t seem that "ParentKeywords": [], gets populated when generated using DXA Component Template Generate Dynamic Component.

"Fields": {
    "theKeyword": {
        "Name": "theKeyword",
        "Values": ["Little Jimmy"],
        "NumericValues": [],
        "DateTimeValues": [],
        "LinkedComponentValues": [],
        "FieldType": 3,
        "CategoryName": "TestCategory",
        "CategoryId": "tcm:286-27081-512",
        "XPath": "tcm:Content/custom:Content/custom:theKeyword",
        "KeywordValues": [{
            "Description": "",
            "Key": "littleJimmy",
            "TaxonomyId": "tcm:286-27081-512",
            "Path": "\\TestCategory\\Stuff2\\Jim\\Little Jimmy",
            "ParentKeywords": [],
            "MetadataFields": {},
            "Id": "tcm:286-164010-1024",
            "Title": "Little Jimmy"
        }]
    }
},

What is the purpose of "ParentKeywords": [], and how can I get it to provide useful data?

1 Answer 1

1

The JSON for a Keyword contains all the properties that are available on an actual Keyword, if you take a look at the properties of a Keyword in the CMS, you will find the following:

enter image description here

Also when you look at the API documentation, you see there is a Keyword.ParentKeywords property, with the following description:

Parent Keywords are used to form a Taxonomy of Keywords. Typically, a parent Keyword is a broader term/concept. The Parent Keywords must be from one of the allowed parent Categories of this Keyword's Category.

This all is related to the Taxonomy API and the ability to create a Keyword tree structure. When yoi create an Abstract Keyword, you can create Keywords under that. When such a Keyword is used, you should see its parent listed in the ParentKeywords array. If you would use the Taxonomy API on the CMS to assign multiple parents to a Keyword (something which can only be done uisng the API programatically, not using the UI), you will get multiple items in the mentioned array.

1
  • Note that as of Tridion Sites 9.6, you can add multiple parents to a Keyword in the (Experience Space) UI. Commented Feb 28, 2022 at 14:18

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.