     res.header "Cache-Control", "no-cache, no-store, must-revalidate"
     res.header "Pragma", "no-cache"
     res.header "Expires", 0
-    s = header + formatList(req, list) + footer + masonry
+    s = header(req.app.locals.templateVars) + formatList(req, list) + footer(req.app.locals.templateVars) + masonry
     res.send s
 exports.serveRandomImage = serveRandomImage
 
 showTextList = (req, res, filter) ->
   getSketches(SKETCH_DIR).then (sketches) ->
     list = sketches.filter(filter)
-    res.send header + '<ul>' + list.map((filename) ->
-      url = req.app.baseUrl + '/image/' + encodeURIComponent(filename)
+    res.send header(req.app.locals.templateVars) + '<ul>' + list.map((filename) ->
+      url = req.app.base + '/image/' + encodeURIComponent(filename)
       return '<li><a href="' + url + '">View</a> - ' + linkTags(filename) + '</li>'
-    ).join('') + '</ul>' + footer
+    ).join('') + '</ul>' + footer(req.app.locals.templateVars)
 exports.showTextList = showTextList
   
 listNonjournalSketches = (req, res) ->

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

################################################################################

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

serveImageByName = (req, res) ->
