title: Iron router not displaying notFound page
body: <p><strong>TL,DR:</strong> How to make the not found template work within a global layout template given the router is running on the client side only (this is a requirement: client and server routes are separated.)</p>
  
  <p>I need iron:router to display a default template when it couldn't match any router.<br>
  In my app, all routers are client side (the router.js file is inside the client folder.)<br>
  So far, this is what my code looks like:</p>
  
  <ol>
  <li><strong>router.js - client side</strong></li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Router.configure({
      layoutTemplate: 'ApplicationLayout'
  });
  
  Router.map(function() {
      this.route('home', {
          path: '/',
  
          onAfterAction: function() {
              document.title = 'MyApp';
          },
  
          action: function() {
              this.render('Home');
              this.render('Menu', {to: 'menu'});
              this.render('Footer', {to: 'footer'});
          } 
      });
  
      this.route('notFound', {
          path: '*',
  
          onAfterAction: function() {
              document.title = 'Page not found - MyApp';
          },
  
          action: function() {
              this.render('NotFound');
              this.render('Menu', {to: 'menu'});
              this.render('Footer', {to: 'footer'});
          }
  
      });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <ol start="2">
  <li><strong>ApplicationLayout.html</strong></li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;template name="ApplicationLayout"&gt;
        
    &lt;div class="nav-container"&gt;
      {{&gt; yield "menu"}}
    &lt;/div&gt;
  
    &lt;div class="main-container"&gt;
      {{&gt; yield}}
    &lt;/div&gt;
  
    &lt;div class="footer-container"&gt;
      {{&gt; yield "footer"}}
    &lt;/div&gt;
  
  &lt;/template&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Reading the docs at <a href="http://eventedmind.github.io/iron-router/#404s-and-client-vs-server-routes" rel="nofollow">http://eventedmind.github.io/iron-router/#404s-and-client-vs-server-routes</a>, it appears the server sends a <code>404</code> but it wasn't. So I made another router on the server side that sends a <code>404</code> but even that fixed nothing.</p>
  
  <ol start="3">
  <li><strong>router.js - server side</strong></li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Router.map(function() {
      this.route('notFound', {
          path: '*',
  
          action: function() {
              this.response.statusCode = 404;
              this.response.end();
          }
      }); 
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Result so far:</strong><br>
  <code>Oops, looks like there's no route on the client or the server for url: "http://localhost:3000/logi/."</code></p>
  
  <p><strong>Other attempts:</strong><br>
  I tried including a <code>notFoundTemplate</code> in the global router configuration and <em>it did display</em> the <code>NotFound</code> template but <s><em>not within</em> the <code>layoutTemplate</code></s> the <code>Menu</code> and <code>Footer</code> templates are not loaded. But if I understand correctly, such template is called when the <code>data</code> function  returns <code>null</code> -  <a href="https://github.com/EventedMind/iron-router/issues/116" rel="nofollow">https://github.com/EventedMind/iron-router/issues/116</a>, see answer by <em>cmather</em>.</p>
  
  <p><strong>Relevant details:</strong></p>
  
  <ol>
  <li>meteor@1.0.3.1</li>
  <li>iron:router@1.0.7</li>
  </ol>
  
  <h3>EDIT</h3>
  
  <p>Using the <code>notFoundTemplate</code> property in the configuration <em>does show</em> the  <code>NotFound</code> template but omits the <code>Menu</code> and <code>Footer</code> templates.</p>