Make definition of docs sections optional #3
All checks were successful
Publish / publish (push) Successful in 18s
All checks were successful
Publish / publish (push) Successful in 18s
This commit is contained in:
parent
81e310dc80
commit
3eb8ac49a3
@ -31,8 +31,9 @@ Use the following syntax:
|
||||
```toml
|
||||
[extra]
|
||||
sections = [
|
||||
"Usage", # Section 1
|
||||
"Extra" # Section 2
|
||||
"Usage", # Section 1
|
||||
"Markdown", # Section 2
|
||||
"Advanced" # Section 3
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
@ -7,22 +7,26 @@
|
||||
<div id="docs">
|
||||
<ul>
|
||||
{%- for page in section.pages %}
|
||||
{%- if page.extra.section == 0 %}
|
||||
<li>
|
||||
<a class="{%- if slug == page.slug -%}active{%- endif -%}" href="{{ page.permalink | safe }}">{{ page.title }}</a>
|
||||
</li>
|
||||
{%- if page.extra.section %}
|
||||
{%- if page.extra.section == 0 %}
|
||||
{% include "partials/docs_toc_item.html" %}
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
{% include "partials/docs_toc_item.html" %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for section in section.extra.sections %}
|
||||
{% set int_section = loop.index %}
|
||||
<h3>{{ section }}</h3>
|
||||
{%- for page in section.pages %}
|
||||
{%- if page.extra.section == int_section %}
|
||||
<li>
|
||||
<a class="{%- if slug == page.slug -%}active{%- endif -%}" href="{{ page.permalink | safe }}">{{ page.title }}</a>
|
||||
</li>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
{%- if section.extra.sections %}
|
||||
{%- for section in section.extra.sections %}
|
||||
{% set int_section = loop.index %}
|
||||
<h3>{{ section }}</h3>
|
||||
{%- for page in section.pages %}
|
||||
{%- if page.extra.section %}
|
||||
{%- if page.extra.section == int_section %}
|
||||
{% include "partials/docs_toc_item.html" %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{% endfor %}
|
||||
{%- endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
3
templates/partials/docs_toc_item.html
Normal file
3
templates/partials/docs_toc_item.html
Normal file
@ -0,0 +1,3 @@
|
||||
<li>
|
||||
<a class="{%- if slug == page.slug -%}active{%- endif -%}" href="{{ page.permalink | safe }}">{{ page.title }}</a>
|
||||
</li>
|
||||
Loading…
x
Reference in New Issue
Block a user