Use subcategories in custom node module


I would like to use subcategories in my custom node module. What I tried:

  • Create subcategory descriptions in the constants.ts file in the editor-ui
  • Reference these subcategories in the respective json files of the custom nodes

I can already see the subcategories showing up, but the names and descriptions are not shown properly. Instead of the selected name it shows nodeCreator.subcategoryNames.SUBCATEGORY where SUBCATEGORY is my selected subcategory name. The same applies for the descriptions.

Has anyone else tried this yet? Maybe my approach by adding this in the constants.ts file is completely wrong…

Hey @hchris1,

What do you mean by sub categories?

@jon Subcategories are already used for the Core Nodes node category in this file. They then show up in the node selection:

	[category: string]: { [subcategory: string]: string };
} = {
	'Core Nodes': { // this - all subkeys are set from codex
		Flow: 'Branches, core triggers, merge data',
		Files:  'Work with CSV, XML, text, images etc.',
		'Data Transformation': 'Manipulate data fields, run code',
		Helpers: 'HTTP Requests (API calls), date and time, scrape HTML',

Hey @hchris1,

Are you trying to add to that list or add a new core node? Or maybe something else and adding subcategories to the existing categories?

@hchris1 What you are seeing are the i18n keys… That’s what you need to do here… Add the description as an i18n key (for example n8n/en.json at master · n8n-io/n8n · GitHub)
(I think we probably need to delete that object from constants)

1 Like

@mutdmour Hey, thank you so much for the hint! All working as expected now. As you mentioned it seems a bit weird that the subcategory name is defined in two places.

These are the necessary steps for anyone else wanting to try subcategories for custom nodes:

  • Add your custom category in YourNode.node.json under the categories key
  • Reference the subcategory in YourNode.node.json under the subcategories key
  • Add your category and its subcategories in constants.ts to SUBCATEGORY_DESCRIPTIONS
  • Add your subcategory names and discriptions in en.json