Dashboard Browser Tab Title - Set from a variable

I'd like to use a variable to set the Browser's Title in it's tab. I know you can manually set it in dashboard settings, but that is not desired as I have numerous instances running (100+) at different locations.

Thank you in advance, for your reply!

You can probably use an environment variable eg ${title}. And set it outside of Node-RED

Not quite sure how that is implemented. I just want the browser tab to show the hostname instead of "Node-RED Dashboard" and I need to do it programmatically, not from the NR Theme setting.

Thank you for the response. Just a hand edit to the settings.js file works well enough for my use.

That's good news. So what change do you make in settings.js?

In settings.js, prior to the "module.exports = {" line, I added:

hostPart1 = "Host: ";
hostPart2 = require('os').hostname();
hostname = hostPart1 + hostPart2;
process.env.HOST_TITLE = hostname;

Then in Node-Red Dashboard "Site" tab, I just set it to: ${HOST_TITLE}.

1 Like

I also find it useful to change the page heading on the editor by setting process.env.DEVICE and adding this immediately below editorTheme: {

header: {
title: process.env.DEVICE
},

I wish the editor and dashboard would default to showing the name of the flows file on the header!

Nice! But, now you got me going down another rabbit hole. I also added:

page: {
    title: process.env.DEVICE
},

So now I get the device name in the browser tab. But, it also adds the suffix of ": IP address" . Wondering how I can drop/change the suffix. Any ideas?

TIA

Don't know, sorry. This is what I currently have. I like to see the IP address.

Yeah, I gave up. I don't spend too much time in the editor anyway. I use the editor on one host and then copy the flow files to all of the other clients once testing is complete.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.