Last active
September 25, 2015 15:39
-
-
Save radiovisual/fb10ade6a3aa275dd627 to your computer and use it in GitHub Desktop.
Add a rootpath value to your keystone templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
exports.assignRootPath = function(req, res, next) { | |
var locals = res.locals; | |
var rootPath = ""; | |
req.path.split(path.sep).forEach(function(item){ | |
if(item) { | |
rootPath += "../"; | |
} | |
}); | |
locals.rootPath = rootPath; | |
next(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment