Hey it's me againš
I'm trying to put a link in the stats node.
But working with the change node and doing this
"< hef="{{msg.link}}" target="_blank" rel="noopener noreferrer">{{msg.payload}}</"a" >"
doesn't work, is that even possible?
Yes, in a change node use JSONata or use a template node
example flow
[{"id":"215c7b5140159f2d","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"link","v":"www.google.com","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"www.msn.com","payloadType":"str","x":340,"y":1400,"wires":[["496f648e34957cd7","ebe19130c9e5cdcb"]]},{"id":"496f648e34957cd7","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"'< hef=\"' & $$.link & '\" target=\"_blank\" rel=\"noopener noreferrer\">' & $$.payload & '</a>'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1380,"wires":[["2b701357156994b7"]]},{"id":"ebe19130c9e5cdcb","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"< hef=\"{{{link}}}\" target=\"_blank\" rel=\"noopener noreferrer\">{{{payload}}}</a>","output":"str","x":520,"y":1440,"wires":[["2b701357156994b7"]]},{"id":"2b701357156994b7","type":"debug","z":"d1395164b4eec73e","name":"debug 2456","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":1340,"wires":[]}]
JSONata
'< hef="' & $$.link & '" target="_blank" rel="noopener noreferrer">' & $$.payload & '</a>'
Template mustache
< hef="{{{link}}}" target="_blank" rel="noopener noreferrer">{{{payload}}}</a>
Thx for your help but unfortunately, it doesn't work.
The top one is the tamplate node, the other the change node.
Maybe you're swapping it, but it's not about the node red ui it's about the flexdash.
Not a flexdash user, but i think flexdash uses R markdown
I think the html < >
are replaced, so displays the full text not the href link.
You could try this
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.