title: Dynamic Handlebars Master Template with Backend
body: <p>used HBS as Template engine in my express app. This issue come when trying to display the title in dynamic page (details page).</p>
  
  <p>My Controllers</p>
  
  <pre><code>exports.getProduct = (req, res, next) =&gt; {
      var prodId = req.params.productId;
      Product.findById(prodId)
      .then(([product]) =&gt; {
          res.render('shop/product-detail', { 
              product: product[0], 
              title: product.title 
          });
      })
      .catch(err =&gt; console.log(err));
  };
  </code></pre>
  
  <p>My Layout</p>
  
  <pre><code>&lt;head&gt;
      &lt;!-- Required meta tags --&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
  
      &lt;!-- Bootstrap CSS --&gt;
      &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"&gt;
  
      &lt;title&gt;{{{ title }}}&lt;/title&gt;
    &lt;/head&gt;
  </code></pre>
  
  <p>My View</p>
  
  <pre><code>
  &lt;div class="container"&gt;
  
  &lt;div class="card-deck"&gt;
    &lt;div class="card"&gt;
      &lt;img src="{{product.imageUrl}}" class="card-img-top" alt="..."&gt;
      &lt;div class="card-body"&gt;
        &lt;h5 class="card-title"&gt;{{product.title}}&lt;/h5&gt;
        &lt;p class="card-text"&gt;{{product.description}}&lt;/p&gt;
        &lt;p class="card-text"&gt;&lt;small class="text-muted"&gt;Rp {{product.price}}&lt;/small&gt;&lt;/p&gt;
        &lt;form action="/add-to-cart" method="POST"&gt;
          &lt;button type="submit" class="btn btn-outline-primary btn-block"&gt;Add to Cart&lt;/button&gt;
          &lt;input type="hidden" name="productId" value="{{product.id}}"&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>In view the product title is working fine. But in the master template (layout) is not showing up.</p>