docs: minimize rendering count (#7343)

Merge pull request 7343
This commit is contained in:
Frank Taillandier 2018-10-28 16:39:32 +01:00 committed by jekyllbot
parent 7d9667f13f
commit c9dda7ad50
4 changed files with 28 additions and 30 deletions

View File

@ -2,7 +2,24 @@
<aside>
{% for section in site.data.docs_nav %}
<h4>{{ section.title }}</h4>
{% include docs_ul.html items=section.docs %}
<ul>
{% for item in section.docs %}
{% assign p = site.documents | where: "url", item.link | first %}
<li class="{% if p.url == '/docs/' %}
{% if page.url == '/docs/' %}current{% endif %}
{% else %}
{% if page.url contains p.url %}current{% endif %}
{% endif %}">
<a href="{{ p.url }}">
{% if p.menu_name %}
{{ p.menu_name }}
{% else %}
{{ p.title }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</aside>
</div>

View File

@ -3,7 +3,16 @@
<option value="">Navigate the docs…</option>
{% for section in site.data.docs_nav %}
<optgroup label="{{ section.title }}">
{% include docs_option.html items=section.docs %}
{% for item in section.docs %}
{% assign p = site.documents | where: "url", item.link | first %}
<option value="{{ p.url }}">
{% if p.menu_name %}
{{ p.menu_name }}
{% else %}
{{ p.title }}
{% endif %}
</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>

View File

@ -1,10 +0,0 @@
{% for item in include.items %}
{% assign p = site.documents | where: "url", item.link | first %}
<option value="{{ p.url }}">
{% if p.menu_name %}
{{ p.menu_name }}
{% else %}
{{ p.title }}
{% endif %}
</option>
{% endfor %}

View File

@ -1,18 +0,0 @@
<ul>
{% for item in include.items %}
{% assign p = site.documents | where: "url", item.link | first %}
<li class="{% if p.url == '/docs/' %}
{% if page.url == '/docs/' %}current{% endif %}
{% else %}
{% if page.url contains p.url %}current{% endif %}
{% endif %}">
<a href="{{ p.url }}">
{% if p.menu_name %}
{{ p.menu_name }}
{% else %}
{{ p.title }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>