             else
               return base + '/' + (i + 1)
     list = getSketchesByRegexp(sketches, regexp).reverse()
-    res.send header + formatList(req, list, urlFunc, '33%') + footer
+    res.send header(req.app.locals.templateVars) + formatList(req, list, urlFunc, '33%') + footer(req.app.locals.templateVars)
 exports.serveImagesByDate = serveImagesByDate
 
 ################################################################################

serveImageByID = (req, res) ->
  getSketches(SKETCH_DIR).then (sketches) ->
    filename = getSketchByID(sketches, req.params.id)
    res.send header + linkToImage(req.app.path(), req.filename) + footer
exports.serveImageByID = serveImageByID

serveImageByName = (req, res) ->

  page = ''
  getSketches(SKETCH_DIR).then (sketches) ->
    q(getSketchesByTags(sketches, tag)).then (list) ->
      res.send header(req.app.locals.templateVars) + formatList(req, list) + footer(req.app.locals.templateVars)
exports.serveImagesByTag = serveImagesByTag

showSketchesByRange = (req, res) ->
