diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output/website.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/output/website.js b/lib/output/website.js index 1ec0548..a208802 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -12,6 +12,11 @@ function themeID(plugin) { return 'theme-' + plugin; } +// Directory for a theme with the templates +function templatesPath(dir) { + return path.join(dir, '_layouts'); +} + function WebsiteOutput() { Output.apply(this, arguments); @@ -50,15 +55,16 @@ WebsiteOutput.prototype.prepare = function() { var searchPaths = _.chain([ // The book itself can contains a "_layouts" folder - that.book.root, + '_layouts', // Installed plugin (it can be identical to themeDefault.root) - that.theme.root, + '_layouts', // Is default theme still installed that.themeDefault? that.themeDefault.root : null ]) .compact() + .map(templatesPath) .uniq() .value(); @@ -87,8 +93,13 @@ WebsiteOutput.prototype.prepare = function() { WebsiteOutput.prototype.onPage = function(page) { var that = this; + // Parse the page + return page.toHTML(this) + // Render the page template with the same context as the json output - return this.render('page', this.getPageContext(page)) + .then(function() { + return that.render('page', that.getPageContext(page)); + }) // Write the HTML file .then(function(html) { @@ -109,7 +120,7 @@ WebsiteOutput.prototype.render = function(tpl, context) { // Return a complete name for a template WebsiteOutput.prototype.templateName = function(name) { - return path.join('_layouts', this.name, name+'.html'); + return path.join(this.name, name+'.html'); }; module.exports = conrefsLoader(WebsiteOutput); |