Sha256: 0302766a7d81ae7f49776b0b5e944a4b98bc58a0c1aab69e2b922aab15c11c7d

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

{% comment %}
Map grabs the doc sections, giving us an array of arrays. Join, flattens all
the items to a comma delimited string. Split turns it into an array again.
{% endcomment %}
{% assign docs = site.data.docs | map: 'docs' | join: ',' | split: ',' %}

{% comment %}
Because this is built for every page, lets find where we are in the ordered
document list by comparing url strings. Then if there's something previous or
next, lets build a link to it.
{% endcomment %}

{% for document in docs %}
  {% assign document_url = document | prepend:"/docs/" | append:"/" %}
  {% if document_url == page.url %}
    <ul class="pager">
      {% if forloop.first %}
        <li class="previous disabled">
          <a>
            <span aria-hidden="true">&larr;</span> Previous
          </a>
        </li>
      {% else %}
        {% assign previous = forloop.index0 | minus: 1 %}
        {% assign previous_page = docs[previous] | prepend:"/docs/" | append:"/" %}
        <li class="previous">
          <a href="{{ previous_page | prepend: site.baseurl }}">
            <span aria-hidden="true">&larr;</span> Previous
          </a>
        </li>
      {% endif %}

      {% if forloop.last %}
        <li class="next disabled">
          <a>
            Next <span aria-hidden="true">&rarr;</span>
          </a>
        </li>
      {% else %}
        {% assign next = forloop.index0 | plus: 1 %}
        {% assign next_page = docs[next] | prepend:"/docs/" | append:"/" %}
        <li class="next">
          <a href="{{ next_page | prepend: site.baseurl }}">
            Next <span aria-hidden="true">&rarr;</span>
          </a>
        </li>
      {% endif %}
      </ul>
    <div class="clear"></div>
    {% break %}
  {% endif %}
{% endfor %}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apx-docs-theme-0.1.15 _includes/section_nav.html
apx-docs-theme-0.1.7 _includes/section_nav.html
apx-docs-theme-0.1.1 _includes/section_nav.html