Route that renders a node has title of route rather than node title I have a route that takes a wildcard $product and then loads a default node that is stored in config. This is working (i.e. the node is rendered on that path) but instead of the node title it is displaying the route title 'Default Product List'. 

Any ideas?

Routing.yml

default_product_list.generate_default_product_list:
  path: '/destinations/{region}/{area}/{town}/{product}'
  defaults:
    _controller: '\Drupal\default_product_list\Controller\DefaultProductListController::generateDefaultProductList'
    _title: 'Default Product List'
  requirements:
    _permission: 'access content'
  method: [GET]


Controller

 /**
   * Generatedefaultproductlist.
   *
   */
  public function generateDefaultProductList($region, $area, $town, $product) {

    $vars = [
      $region,
      $area,
      $town,
      $product
    ];

    $config = $this-&gt;config('default_product_list.defaultproductlist');

    $data = $config-&gt;get();

    if ($product === 'accomodation') {
      if (isset($data['default_accomodation_product'])) {
        $node = $this-&gt;defaultProductListUtility-&gt;loadDefaultNode($data['default_accomodation_product']);
        if (isset($node)) {
          $view_builder = $this-&gt;entityTypeManager()-&gt;getViewBuilder('node');
          $build = $view_builder-&gt;view($node);
//          kint(array($build));
          return array($build);
        }
      }
    }

  }
As it is routing path, Drupal will always look for the title in routing.yml, if you want to set title for this you can do as follows,

$build['#attached']['html_head'][] = [
    [
      '#tag' =&gt; 'title',
      '#value' =&gt; "Node title"
    ],
    'title'
  ];


OR

$build['#title'] = 'Node Title';


Here you can replace "Node Title" with your dynamic node titles.