diff options
-rw-r--r-- | lib/output/website.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/output/website.js b/lib/output/website.js index 3cf890e..1eaf98a 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -216,11 +216,24 @@ WebsiteOutput.prototype.outputMultilingualIndex = function() { // Render a template using nunjucks // Templates are stored in `_layouts` folders WebsiteOutput.prototype.render = function(tpl, context) { + var that = this; var filename = this.templateName(tpl); context = _.extend(context, { template: { - self: filename + self: filename, + getJSContext: function() { + return { + page: _.omit(context.page, 'content'), + config: context.config, + file: context.file, + gitbook: context.gitbook, + basePath: location.normalize(that.resolveForPage(context.file.path, './')), + book: { + language: context.book.language + } + }; + } }, plugins: { |