Twig invalid render array keys from a valid array In hook_preprocess_menu I am creating an array to send to the menu twig tpl (eventually it will be entity paragraph data but for now they are hard values as examples). However, I just receive array key invalid errors. How should this be formatted correctly for the template?

function hook_preprocess_menu__main_menu(&amp;$vars) {

  $node = \Drupal::routeMatch()-&gt;getParameter('node');
  if($node-&gt;field_menu_highlights){
    $highlight_values = $node-&gt;get('field_menu_highlights')-&gt;getValue();

    foreach ($highlight_values as $key =&gt; $item){
      $ent = \Drupal\paragraphs\Entity\Paragraph::load($item['target_id']);
      $vars['highlight'][$key]['title'] = 'Title here';
      $vars['highlight'][$key]['desc'] = 'Description here';

    }
  }
}


The template:

{% for value in highlight %}
    {{ value }}
{% endfor %}


Error eg:

User error: "title" is an invalid render array key in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).
Build the array with renderable children:

  $vars['highlight'][$key] = [
    'title' =&gt; [
      '#markup' =&gt; 'Title here',
    ],
    'desc' =&gt; [
      '#markup' =&gt; 'Description here',
    ],
  ];


Now the loop to render each value separately should work or have the same result by rendering the complete render array:

{{ highlight }}