summaryrefslogtreecommitdiffstats
path: root/lib/output/website.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output/website.js')
-rw-r--r--lib/output/website.js19
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) {