# Custom node category and node-red retro compatibility

**URL:** https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234
**Category:** Developing Nodes
**Created:** [28 October 2019 13:53 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234 "2019-10-28T13:53:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![edorgeville](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edorgeville/32/8588_2.png) [@edorgeville](https://discourse.nodered.org/u/edorgeville)
#### Post date: [28 October 2019 13:53 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/1 "2019-10-28T13:53:25Z")

</div>

Hi there!

As per node-red 1.0.0, [most i/o nodes have been moved to the `network` category](https://github.com/node-red/node-red/commit/69b781419fa06c986ad8fa2a6f398f1222a9f595).  
This makes some of our custom nodes look all alone and sad in their old `input` and `output` categories. We want to move them to the new `network` category, but keep `input` and `output` for \<1.0.0 installs.  
What would be the best way to achieve this? I looked a bit but didn't find anything in the docs regarding this.

Thanks!

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [28 October 2019 14:06 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/2 "2019-10-28T14:06:04Z")

</div>

I have not personally used `RED.version()` in a custom node myself.  
[https://nodered.org/docs/api/modules/v/0.20.0/node-red.html#.version](https://nodered.org/docs/api/modules/v/0.20.0/node-red.html#.version)  
Seeing that the category in the palette is specified in the HTML file that has access to `RED.foo` kind of functions, you could try to define it as a ternary: `category: version >= 1 ? 'network' : 'input'`, where `version` would be the major from the aforementioned function.

---

<div class="post-metadata">

### Author: ![edorgeville](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edorgeville/32/8588_2.png) [@edorgeville](https://discourse.nodered.org/u/edorgeville)
#### Post date: [28 October 2019 14:08 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/3 "2019-10-28T14:08:35Z")

</div>

> [@afelix](#):
>
> RED.version()

I'll try this, thanks!

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [28 October 2019 14:18 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/4 "2019-10-28T14:18:40Z")

</div>

That will not work because `RED.version()` is a runtime API available in the JavaScript file - but the node category is set in the HTML file. There is no equivalent API available in the HTML side of things.

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [28 October 2019 14:32 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/5 "2019-10-28T14:32:08Z")

</div>

> [@knolleary](#):
>
> There is no equivalent API available in the HTML side of things.

Taking the API docs in mind, when calling `RED.nodes.registerType` in the HTML file, which of the `RED.nodes` parts does it refer to?

- [node-red - Documentation](https://nodered.org/docs/api/modules/v/0.20.0/node-red.html#.nodes)
- [@node-red/runtime - Documentation](https://nodered.org/docs/api/modules/v/0.20.0/@node-red_runtime.html#.nodes)
- Something else that is not documented?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [28 October 2019 14:54 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/6 "2019-10-28T14:54:18Z")

</div>

The docs you link to are all runtime docs. We haven't formally documented the html side API beyond what is described throughout the 'creating nodes' docs.

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [28 October 2019 14:55 UTC](https://discourse.nodered.org/t/custom-node-category-and-node-red-retro-compatibility/17234/7 "2019-10-28T14:55:30Z")

</div>

Good to know. That means I've been referencing the wrong docs for both relevant topics, as well as working on nodes myself all the time. Note to self for the future, definitely. Thanks 😃
