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.
This commit is contained in:
parent
a92ff6c9b4
commit
44b4a068f4
2 changed files with 25 additions and 1 deletions
|
@ -131,7 +131,11 @@
|
||||||
|
|
||||||
<div id="wrap">
|
<div id="wrap">
|
||||||
{% block content -%}
|
{% block content -%}
|
||||||
{{ section.content | safe }}
|
{%- if section.word_count > 0 -%}
|
||||||
|
{{ section.content |safe }}
|
||||||
|
{%- else -%}
|
||||||
|
{%- include "sec_toc_2_level.html" -%}
|
||||||
|
{% endif -%}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
20
templates/sec_toc_2_level.html
Normal file
20
templates/sec_toc_2_level.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
{% if section.subsections -%}
|
||||||
|
<ul>
|
||||||
|
{% for subsec in section.subsections -%}
|
||||||
|
{% set sec_ = get_section(path=subsec) -%}
|
||||||
|
<li>
|
||||||
|
<a href="{{ sec_.permalink | safe }}">{{ sec_.title }}</a>
|
||||||
|
{% if sec_.pages -%}
|
||||||
|
<ul>
|
||||||
|
{% for page_ in sec_.pages -%}
|
||||||
|
<li><a href="{{ page_.permalink | safe }}">{{ page_.title }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif -%}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% else -%}
|
||||||
|
<h3> No Sections Found </h3>
|
||||||
|
{% endif -%}
|
Loading…
Reference in a new issue