From 44b4a068f447ed1ec28aaf2e28448e354918d4e7 Mon Sep 17 00:00:00 2001 From: Che <43485962+c-git@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:56:49 -0400 Subject: [PATCH] Table of Contents for Landing Page If no content has been set for the landing page, put up a table of contents by default. Many simple sites don't need a landing page that has more than a table of contents. --- templates/index.html | 6 +++++- templates/sec_toc_2_level.html | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 templates/sec_toc_2_level.html diff --git a/templates/index.html b/templates/index.html index d4c407d..a1db8ac 100644 --- a/templates/index.html +++ b/templates/index.html @@ -131,7 +131,11 @@
{% block content -%} - {{ section.content | safe }} + {%- if section.word_count > 0 -%} + {{ section.content |safe }} + {%- else -%} + {%- include "sec_toc_2_level.html" -%} + {% endif -%} {% endblock content %}
diff --git a/templates/sec_toc_2_level.html b/templates/sec_toc_2_level.html new file mode 100644 index 0000000..a9e730b --- /dev/null +++ b/templates/sec_toc_2_level.html @@ -0,0 +1,20 @@ +

Table of Contents

+{% if section.subsections -%} + +{% else -%} +

No Sections Found

+{% endif -%}