Line break Twig question I want to add line breaks in title field
I managed to use the replace functions in the template >

{{ node.getTitle()|replace({'|': '&lt;br /&gt;'}) }}


Replacement works, but outputs the field as non-HTML. Do you know about a way to force an HTML output? Or any other way to be the  a real line break instead?
It should help to use the raw filter, like @leymannx commented, but then your template is unsafe, because you should never use the raw filter on template variables containing user input.

So escape the node title first, then add the HTML (which you know is safe because it's hardcoded), before passing it through the raw filter:

{{ node.getTitle()|e|replace({'|': '&lt;br /&gt;'})|raw }}