diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output/ebook.js | 5 | ||||
-rw-r--r-- | lib/output/website.js | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/output/ebook.js b/lib/output/ebook.js index fc9cfd7..801d058 100644 --- a/lib/output/ebook.js +++ b/lib/output/ebook.js @@ -159,4 +159,9 @@ EbookOutput.prototype.ebookConvertOption = function() { }); }; +// Don't write multi-lingual index for wbook +EbookOutput.prototype.outputMultilingualIndex = function() { + +}; + module.exports = EbookOutput; diff --git a/lib/output/website.js b/lib/output/website.js index 6961a28..0beef24 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -210,11 +210,30 @@ WebsiteOutput.prototype.finish = function() { .then(function() { if (that.book.isLanguageBook()) return; return that.plugins.copyResources(that.name, that.resolve('gitbook')); + }) + + // Generate homepage to select languages + .then(function() { + if (!that.book.isMultilingual()) return; + return that.outputMultilingualIndex(); }); }; // ----- Utilities ---- +// Write multi-languages index +WebsiteOutput.prototype.outputMultilingualIndex = function() { + var that = this; + + return that.render('languages', that.getContext()) + .then(function(html) { + return that.writeFile( + 'index.html', + html + ); + }); +}; + // Render a template using nunjucks // Templates are stored in `_layouts` folders WebsiteOutput.prototype.render = function(tpl, context) { |