diff --git a/lib/output/website.js b/lib/output/website.js index 2533deec6..3cf890e79 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -96,6 +96,14 @@ WebsiteOutput.prototype.prepare = function() { return that.toURL(s); }); + // Get an article using its path + that.env.addFilter('getArticleByPath', function(s) { + var article = that.book.summary.getArticle(s); + if (!article) return undefined; + + return article.getContext(); + }); + // Relase path to an asset that.env.addFilter('resolveAsset', function(href) { href = path.join('gitbook', href);