title: How to create global variables accessible in all views using Express / Node.JS?
body: <p>Ok, so I have built a blog using <a href="http://jekyllrb.com/">Jekyll</a> and you can define variables in a file <code>_config.yml</code> which are accessible in all of the templates/layouts. I am currently using <a href="http://nodejs.org">Node.JS</a> / <a href="http://expressjs.com">Express</a> with <a href="http://embeddedjs.com/">EJS</a> templates and <a href="https://github.com/RandomEtc/ejs-locals">ejs-locals</a> (for partials/layouts. I am looking to do something similar to the global variables like <code>site.title</code> that are found in <code>_config.yml</code> if anyone is familiar with Jekyll.  I have variables like the site's title, (rather than page title), author/company name, which stay the same on all of my pages. </p>
  
  <p>Here is an example of what I am currently doing.:</p>
  
  <pre><code>exports.index = function(req, res){
      res.render('index', { 
          siteTitle: 'My Website Title',
          pageTitle: 'The Root Splash Page',
          author: 'Cory Gross',
          description: 'My app description',
          indexSpecificData: someData
      });
  };
  
  exports.home = function (req, res) {
      res.render('home', {
          siteTitle: 'My Website Title',
          pageTitle: 'The Home Page',
          author: 'Cory Gross',
          description: 'My app description',
          homeSpecificData: someOtherData
      });
  };
  </code></pre>
  
  <p>I would like to be able to define variables like my site's title, description, author, etc in one place and have them accessible in my layouts/templates through EJS without having to pass them as options to each call to <code>res.render</code>. Is there a way to do this and still allow me to pass in other variables specific to each page?</p>