istio.io/_includes/doc-side-nav.html

60 lines
1.6 KiB
HTML

<ul class="doc-side-nav">
{% assign components = page.path | downcase | split: '/' %}
{% assign section = components[1] %}
{% assign foundSection = false %}
{% assign docs = site.docs %}
{% for d in docs %}
{% assign components = d.path | downcase | split: '/' %}
{% if components[1] == section %}
{% if components[2] == 'index.md' %}
{% assign foundSection = true %}
<li><h5 class='doc-side-nav-title'>{{d.title}}</h5></li>
{% endif %}
{% endif %}
{% endfor %}
{% if foundSection == true %}
<li><h5 class='doc-side-nav-title'>{{d.title}}</h5></li>
<script type="text/javascript">
var docs = [];
{% for d in docs %}
{% assign components = d.path | downcase | split: '/' %}
{% if components[1] == section %}
docs.push({path: [
{% for comp in components %}
{% if forloop.index > 2 %}
"{{ comp }}",
{% endif %}
{% endfor %}
], url: "{{d.url}}", title: "{{d.title}}", order: {{d.order}}, overview: "{{d.overview}}"});
{% endif %}
{% endfor %}
genNavBarTree(docs)
</script>
{% endif %}
</ul>
<style>
.tree li { padding-left: 20px; }
.tree-toggle {
cursor: pointer;
margin-left: -1em;
}
</style>
<script type="text/javascript">
(function($) {
$(document).ready(function() {
/* toggle category tree */
$(document).on('click', '.tree-toggle', function () {
$(this).children('i.fa').toggleClass('fa-caret-right');
$(this).children('i.fa').toggleClass('fa-caret-down');
$(this).parent().children('ul.tree').toggle(200);
});
});
}(jQuery));
</script>