Make the table of contents in the docs stay visible

This commit is contained in:
Jed Fox
2017-10-26 17:38:02 -04:00
parent 7f93af8745
commit c8351f6e76
2 changed files with 46 additions and 25 deletions

View File

@@ -38,34 +38,36 @@ layout: default
</p>
</div>
<div id="toc" class="col-md-3 py-6">
{% for section in site.data.toc %}
<h2 class="alt-h4">{{ section[0] }}</h2>
<div class="toc-wrap">
{% for section in site.data.toc %}
<h2 class="alt-h4">{{ section[0] }}</h2>
<ul class="mt-2 mb-4 list-style-none">
{% for item in section[1] %}
<li>
{% if item.url %}
{% assign link = item %}
{% else %}
{% for doc in site.pages %}
{% if doc.path == item %}
{% assign link = doc %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
<ul class="mt-2 mb-4 list-style-none">
{% for item in section[1] %}
<li>
{% if item.url %}
{% assign link = item %}
{% else %}
{% for doc in site.pages %}
{% if doc.path == item %}
{% assign link = doc %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{% if page.url == link.url %}
{% assign classes = "text-brand-red" %}
{% else %}
{% assign classes = "text-gray-light" %}
{% endif %}
{% if page.url == link.url %}
{% assign classes = "text-brand-red" %}
{% else %}
{% assign classes = "text-gray-light" %}
{% endif %}
<a class="d-block no-underline py-1 {{classes}}" href="{{ link.url }}">{{ link.title }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
<a class="d-block no-underline py-1 {{classes}}" href="{{ link.url }}">{{ link.title }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</div>
</div>
</div>
</div>