Skip to content
Snippets Groups Projects
Select Git revision
  • 3d1b8adb133080daa7a418b79eb85ad8d6a5e0bf
  • master default
  • patch-1
3 results

pagination.html

Blame
  • Forked from KWARC / kwarc.info / www
    818 commits behind the upstream repository.
    user avatar
    Tom Wiesing authored
    7cc3ac54
    History
    pagination.html 1.79 KiB
    {% comment %}
        Renders a pagination element. 
        Expects the default jekyll 'paginator' as argument. 
    {% endcomment %}
    
    <ul class="pagination">
        
        <!-- The previous page -->
        {% if paginator.previous_page %}
            <li class="waves-effect">
                <a href="{{ site.baseurl }}{{paginator.previous_page_path}}">
                    <i class="material-icons">chevron_left</i>
                </a>
            </li>
        {% else %}
            <li class="disabled">
                <a href="#!">
                    <i class="material-icons">chevron_left</i>
                </a>
            </li>
        {% endif %}
        
        <!-- Show all the pages -->
        {% for page in (1..paginator.total_pages) %}
            {% if page == paginator.page %}
                <li class='active'>
                    <a href="#!">
                        {{page}}
                    </a>
                </li>
            {% elsif page == 1 %}
                <li class="waves-effect">
                    <a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">
                        {{page}}
                    </a>
                </li>
            {% else %}
                <li class="waves-effect">
                    <a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">
                        {{page}}
                    </a>
                </li>
            {% endif %}
        {% endfor %}
        
        
        <!-- The next page -->
        {% if paginator.next_page %}
            <li class="waves-effect">
                <a href="{{ site.baseurl }}{{paginator.next_page_path}}">
                    <i class="material-icons">chevron_right</i>
                </a>
            </li>
        {% else %}
            <li class="disabled">
                <a href="#!">
                    <i class="material-icons">chevron_right</i>
                </a>
            </li>
        {% endif %}
        
    </ul>