Why is Twig not outputting this correctly? I have 

function hook_theme_preprocess(array &amp;$variables, $hook) {
    $variables['bla'] = ' AA &lt;strong&gt; BB &lt;/strong&gt; CC ';
}


In my template I have:

{{ bla }}


The problem is, in some cases the  html is stripped. Even if I do this:

{{ bla | raw }}


This works fine on all pages where this template is used, except on the home page. On the home page, for some bizarre reason, it strips the HTML.

Any idea as to why there would be different behaviour depending on which page I am on?
It's unsafe to use the |raw filter. Put HTML markup in a #markup element instead:

$variables['foo'] = [
  '#markup' =&gt; ' AA &lt;strong&gt; BB &lt;/strong&gt; CC ',
];


Then outputting this variable in Twig should work:

{{ foo }}