{% if DEFAULT_PAGINATION %}
  <nav>
    <ul class="pagination">
      {% if articles_page.has_previous() %}
        <li>
          <a href="{{ SITEURL }}/{{ articles_previous_page.url }}"
              aria-label="Previous" rel="prev">
            <span aria-hidden="true">&larr;</span>
          </a>
        </li>
      {% else %}
        <li class="disabled">
          <a aria-label="Previous" rel="prev">
            <span aria-hidden="true">&larr;</span>
          </a>
        </li>
      {% endif %}

      {% for num in articles_paginator.page_range %}
        {% set linked_pages = [
             1, 2, articles_page.number - 1, articles_page.number,
             articles_page.number + 1, articles_paginator.num_pages - 1,
             articles_paginator.num_pages] %}
        {% if num in linked_pages %}
          {% set is_current_page = (num == articles_page.number) -%}
          <li class="{{ 'active' if is_current_page else '' }}">
            <a href="{{ SITEURL }}/{{ articles_paginator.page(num).url }}"
              rel="
                {% if num == 1 %} first {% endif %}
                {% if num == articles_paginator.num_pages %} last {% endif %}
                {% if num == (articles_page.number - 1) %} prev {% endif %}
                {% if num == (articles_page.number + 1) %} next {% endif %}">
              {{ num }}
              {% if is_current_page  %}
                <span class="sr-only">(current)</span>
              {% endif %}
            </a>
          </li>
        {% elif (num - 1) in linked_pages %}
          <li class="disabled"><a>…</a></li>
        {% endif %}
      {% endfor %}

      {% if articles_page.has_next() %}
        <li>
          <a href="{{ SITEURL }}/{{ articles_next_page.url }}"
              aria-label="Next" rel="next">
            <span aria-hidden="true">&rarr;</span>
          </a>
        </li>
      {% else %}
        <li class="disabled">
          <a aria-label="Next" rel="next">
            <span aria-hidden="true">&rarr;</span>
          </a>
        </li>
      {% endif %}
    </ul>
  </nav>
{% endif %}
