Document conditional TOC rendering (#1376)
* Document conditional TOC rendering * Simplify demonstration of conditional rendering
This commit is contained in:
parent
8630c790b8
commit
d29693066e
|
@ -12,6 +12,7 @@ documentation for information on its structure.
|
||||||
Here is an example of using that field to render a two-level table of contents:
|
Here is an example of using that field to render a two-level table of contents:
|
||||||
|
|
||||||
```jinja2
|
```jinja2
|
||||||
|
{% if page.toc %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for h1 in page.toc %}
|
{% for h1 in page.toc %}
|
||||||
<li>
|
<li>
|
||||||
|
@ -28,6 +29,7 @@ Here is an example of using that field to render a two-level table of contents:
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
{% endif %}
|
||||||
```
|
```
|
||||||
|
|
||||||
While headers are neatly ordered in this example, it will work just as well with disjoint headers.
|
While headers are neatly ordered in this example, it will work just as well with disjoint headers.
|
||||||
|
|
Loading…
Reference in a new issue