diff --git a/theme/templates/includes/book/summary.html b/theme/templates/includes/book/summary.html
index b4859fce0..697cce87c 100644
--- a/theme/templates/includes/book/summary.html
+++ b/theme/templates/includes/book/summary.html
@@ -1,3 +1,22 @@
+{% macro articles(_articles) %}
+ {% for item in _articles %}
+
+ {% if item.path %}
+
+ {{ item.level }}. {{ item.title }}
+
+ {% else %}
+ {{ item.level }}. {{ item.title }}
+ {% endif %}
+ {% if item.articles.length > 0 %}
+
+ {{ articles(item.articles) }}
+
+ {% endif %}
+
+ {% endfor %}
+{% endmacro %}
+
@@ -32,32 +51,7 @@
Introduction
- {% for item in summary.chapters %}
-
- {% if item.path %}
-
- {{ item.level }}. {{ item.title }}
-
- {% else %}
- {{ item.level }}. {{ item.title }}
- {% endif %}
- {% if item.articles.length > 0 %}
-
- {% for article in item.articles %}
- -
- {% if article.path %}
-
- {{ article.level }}. {{ article.title }}
-
- {% else %}
- {{ article.level }}. {{ article.title }}
- {% endif %}
-
- {% endfor %}
-
- {% endif %}
-
- {% endfor %}
+ {{ articles(summary.chapters) }}
{% if options.links.gitbook !== false %}