Skip to content
Max McKenzie edited this page Jan 2, 2016 · 2 revisions

To create new pages you'll need to add a template and a route in the index.js file

So if we wanted to add a contact page.

  • Create the file contact.twig in the /views/pages directory if you are creating a global element such as a footer, header or sidebar, create this in /views/blocks. If you are creating a component for use accross pages and blocks create it in the /views/elements directory.

  • If you so desire including the header and footer can be done with an include in twig http://twig.sensiolabs.org/doc/tags/include.html

{% include '../blocks/header.html' %}
    contact page content
{% include '../blocks/footer.html' %}
  • create the route in express by adding an app.get to the index.js file.
app.get('/contact', function(req, res){
  res.render('pages/contact.twig', {
   //pass variables to the template file per the below example.    
   //templateVar : "Hello World"
  });
});

once you've done this you can know navigate to the /contact

Clone this wiki locally