diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-24 13:35:59 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-24 13:35:59 +0100 |
commit | e85ad95bcf3627a223b3a2eacaa29835142249eb (patch) | |
tree | 1195387b49276e8b0b5b1c9185371c9f96a9ad38 /lib/output/website.js | |
parent | bd73c7978743329f893c1125d1645b8aa24eb7d8 (diff) | |
download | gitbook-e85ad95bcf3627a223b3a2eacaa29835142249eb.zip gitbook-e85ad95bcf3627a223b3a2eacaa29835142249eb.tar.gz gitbook-e85ad95bcf3627a223b3a2eacaa29835142249eb.tar.bz2 |
Generate multi-lingual index
Diffstat (limited to 'lib/output/website.js')
-rw-r--r-- | lib/output/website.js | 19 |
1 files changed, 19 insertions, 0 deletions
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) { |