concatenation of HTML from return functions My controller is looking something like this.

Each of the methods called generate some HTML. The concatenated HTML variable gives the final render of the page 

Is there a better way to generate my HTML to render coming from different functions:

 $html = $renderer-&gt;render($clear_form);
 $html .= $this-&gt;render_preview();
 $config = \Drupal::config('amu_import_ldap.settings');
 if (null != $config) {
   $submits = $config-&gt;get('import_submits');
   $html .= $this-&gt;render_ldap_imports($submits);
 }
 $build = [
  '#markup' =&gt; Markup::create("
            {$html}
        "),
];
return $build;
Use a template engine like Twig, Plates or Blade.

You should have base layouts, partials and templates.