I am using Sitecore 10.2 and also using Sitecore Cortex Content Tagging. I have different tag which is being created in Sitecore. I want to tag content that is available in tags only, I don't want to create new tags. I did not find any document related to this. Could you please help?
1 Answer
There is no out-of-the-box setting that will allow to disable creation of new tags.
However, you can create a custom taxonomy provider for Sitecore Content Tagging and implement your own logic in the CreateTags
method or simply override the method CreateTag
of DefaultTaxonomyProvider
:
public class CustomTaxonomyProvider : DefaultTaxonomyProvider
{
protected override ID CreateTag(TagData data)
{
//your logic for creating or skipping a tag
return tagId;
}
}
Then your custom taxonomy provider can be registered in the config to be used in Content Tagging functionality:
<contentTagging>
<providers>
<taxonomy>
<add name="CustomTaxonomyProvider" type="Namespace.CustomTaxonomyProvider, AssemblyName" />
</taxonomy>
</providers>
</contentTagging>
Sitecore documentation for custom Content Tagging providers can be found here.
-
Thanks, Anna for your response. I understand that I can restrict the tag to not be created in Sitecore but I want to get only the taxonomy that is available in Sitecore. Currently, in IDiscoveryProvider, the cortex will return some taxonomy that may be not in my Sitecore. Suppose I have taxonomy A, B, C in Sitecore and Cortex is returning D, E then in this case it will not be useful for me. I want to pass A,B, C to Cortex, and Cortex can return relevant taxonomy may be B,C Sep 24, 2022 at 15:06
-
@SwatiGupta thanks for clarification. I had another look at the Open Calais API that Sitecore uses and it does not have any parameter to include/exclude specific tags in the API response developers.refinitiv.com/en/api-catalog/open-perm-id/…. You can try implementing a custom discovery provider (
IDiscoveryProvider
) and take only required tags from the API response (GetTags
). I know it won't return tags A, B or C if Open Calais thinks there are only D and E in the provided content, but hopefully it will help you filter out unnecessary tags Sep 27, 2022 at 7:27 -
1Thanks, @Anna, I think OpenCalais will not fit in my requirement :) Sep 27, 2022 at 7:45