diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output/website.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/output/website.js b/lib/output/website.js index 835b8b5..929c82f 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -179,7 +179,19 @@ WebsiteOutput.prototype.onPage = function(page) { // Render a template using nunjucks // Templates are stored in `_layouts` folders WebsiteOutput.prototype.render = function(tpl, context) { - return Promise.nfcall(this.env.render.bind(this.env), this.templateName(tpl), context); + var filename = this.templateName(tpl); + + context = _.extend(context, { + template: { + // Same template but in the default theme + default: this.themeDefault? path.resolve(templatesPath(this.themeDefault.root), filename) : null, + + // Same template but in the theme + theme: path.resolve(templatesPath(this.theme.root), filename) + } + }); + + return Promise.nfcall(this.env.render.bind(this.env), filename, context); }; // Return a complete name for a template |