{%- comment -%}

render_indices

creates the individual links in the sidebar
- pages, layouts, and guide-indexes are indented when parented

params:

doc_list=<array of document objects to create links for>
collection_label=<name of collection the docs belong to>
page_title=<title of the calling page>
no_indent=<pipe delimited list of layouts that should not be indented>

{%- endcomment -%}

{%- comment -%}push prior state{%- endcomment -%} {%- assign __no_indenting = no_indenting -%} {%- assign __link = link -%} {%- assign __url = url -%} {%- assign __item_id = item_id -%} {%- assign __item_class = item_class -%} {%- assign __path_bits = path_bits -%} {%- assign __n = n -%} {%- assign __indent = indent -%}

{% assign no_indenting = include.no_indent | split: '|' %} {% for doc in include.doc_list %}

{% capture link %}{{ doc.title }}{% endcapture %}
{% capture url %}{{ doc.url }}#/{{ include.collection_label | downcase }}/{% endcapture %}
{% capture item_id %}{% if doc.title == include.page_title %} id="active-page-index"{% endif %}{% endcapture %}
{% capture item_class %}{% if doc.title == include.page_title %}active {% endif %}item{% endcapture %}
{% unless no_indenting contains doc.layout %}
  {% assign path_bits = doc.relative_path | split: '.' | first | split: '/' %}
  {% assign n = path_bits.size | minus: 2 %}
  {% if n == 0 %}{% assign item_class = item_class | append: ' header' %}{% endif %}
  {% if n > 3 %}{% assign n = 3 %}{% endif %}
  {% capture indent %}{% for i in (1..n) %}&ensp;{% endfor %}{% endcapture %}
  {% capture link %}{{ indent }}{{ doc.title }}{% endcapture %}
{% endunless %}
<a{{ item_id }} class="very tight smaller text {{ item_class }}" href="{{ site.baseurl }}{{ url }}">{{ link }}</a>

{% endfor %}

{%- comment -%}pop prior state{%- endcomment -%} {%- assign indent = __indent -%} {%- assign n = __n -%} {%- assign path_bits = __path_bits -%} {%- assign item_class = __item_class -%} {%- assign item_id = __item_id -%} {%- assign url = __url -%} {%- assign link = __link -%} {%- assign no_indenting = __no_indenting -%}