diff options
-rw-r--r-- | docs/_layouts/website/page.html | 14 | ||||
-rw-r--r-- | lib/output/website.js | 14 |
2 files changed, 27 insertions, 1 deletions
diff --git a/docs/_layouts/website/page.html b/docs/_layouts/website/page.html new file mode 100644 index 0000000..edce251 --- /dev/null +++ b/docs/_layouts/website/page.html @@ -0,0 +1,14 @@ +{% extends template.theme %} + +{% block page %} +{{ super() }} +<hr> +<div class="btn-group btn-group-justified"> + {% if page.previous and page.previous.path %} + <a class="btn" href="{{ page.previous.path|resolveFile }}"><b>Previous:</b> {{ page.previous.title }}</a> + {% endif %} + {% if page.next and page.next.path %} + <a class="btn" href="{{ page.next.path|resolveFile }}"><b>Next:</b> {{ page.next.title }}</a> + {% endif %} +</div> +{% endblock %} 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 |