title: Partials with Node.js + Express + Hogan.js
body: <p>I'm developing a site with Node.js + Express and using as view engine Hogan.js.</p>
  
  <p>This is my file <code>app.js</code>:</p>
  
  <pre><code>/**
   * Module dependencies.
   */
  
  var express = require('express')
    , routes = require('./routes')
    , user = require('./routes/user')
    , http = require('http')
    , path = require('path');
  
  var app = express();
  
  app.configure(function(){
    app.set('port', process.env.PORT || 3000);
    app.set('views', __dirname + '/views');
    app.set('view engine', 'hjs');
    app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.cookieParser('your secret here'));
    app.use(express.session());
    app.use(app.router);
    app.use(require('less-middleware')({ src: __dirname + '/public' }));
    app.use(express.static(path.join(__dirname, 'public')));
  });
  
  app.configure('development', function(){
    app.use(express.errorHandler());
  });
  
  app.get('/', routes.index);
  app.get('/about', routes.about);
  app.get('/users', user.list);
  
  http.createServer(app).listen(app.get('port'), function(){
    console.log("Express server listening on port " + app.get('port'));
  });
  </code></pre>
  
  <p>The file <code>/routes/index.js</code> is:</p>
  
  <pre><code>/*
   * GET pages.
   */
  
  exports.index = function(req, res){
    res.render(
      'index',
      {
        title: 'Home Page',
        author: 'Bruce Wayne'
      }
    );
  };
  
  exports.about = function(req, res){
    res.render(
      'about',
      {
        title: 'About Page',
        author: 'Bruce Wayne'
      }
    );
  };
  </code></pre>
  
  <p>In <code>/views</code> folder, there are:</p>
  
  <p>|- <code>part.hjs</code></p>
  
  <p>|- <code>index.hjs</code></p>
  
  <p>|- <code>cv.hjs</code></p>
  
  <p>The file <code>part.hjs</code> is:</p>
  
  <pre><code>&lt;h3&gt;Hello {{ author }}&lt;/h3&gt;
  </code></pre>
  
  <p>The file <code>index.hjs</code> is:</p>
  
  <pre><code>&lt;h1&gt;Title: {{ title }} &lt;/h1&gt;
  {{&gt; part }}
  Welcome to Gotham City.
  </code></pre>
  
  <p>And the file <code>about.hjs</code> is:</p>
  
  <pre><code>&lt;h1&gt;Title: {{ title }}&lt;/h1&gt;
  {{&gt; part }}
  I'm not Joker.
  </code></pre>
  
  <p>I've two questions:</p>
  
  <ol>
  <li>How can I use properly the partials in my pages? (this code doesn't work)</li>
  <li>Can I use the same "title" for two or more pages without repeat the values assignment in file <code>/routes/index.js</code>?</li>
  </ol>
  
  <p>Best regards, Vi.</p>