<nav role="navigation" aria-label="Pages" class="bux-pagination">
<ul class="bux-pagination__list">
<li class="bux-pagination__item">
<a class="bux-pagination__link bux-pagination__link--previous" href="#" rel="noopener" aria-label="Go to previous page">
</a>
</li>
<li class="bux-pagination__item">
<a class="bux-pagination__link" href="#" rel="noopener" aria-label="Page 1">
<span class="bux-pagination__link__text">1</span>
</a>
</li>
<li class="bux-pagination__item">
<a class="bux-pagination__link" href="#" rel="noopener" aria-label="Page 2">
<span class="bux-pagination__link__text">2</span>
</a>
</li>
<li class="bux-pagination__item">
<a class="bux-pagination__link bux-pagination__link--current" href="#" rel="noopener" aria-label="Current page, page 3" aria-current>
<span class="bux-pagination__link__text bux-pagination__link--current__text">3</span>
</a>
</li>
<li class="bux-pagination__item">
<a class="bux-pagination__link" href="#" rel="noopener" aria-label="Page 4">
<span class="bux-pagination__link__text">4</span>
</a>
</li>
<li class="bux-pagination__item">
<a class="bux-pagination__link" href="#" rel="noopener" aria-label="Page 5">
<span class="bux-pagination__link__text">5</span>
</a>
</li>
<li class="bux-pagination__item">
<a class="bux-pagination__link bux-pagination__link--next" href="#" rel="noopener" aria-label="Go to next page">
</a>
</li>
</ul>
</nav>
{#
Pagination
Available variables:
- modifier: Sets the pagination variant. Can be null or alt.
- current_page: Integer for the current page, starting at 1.
- previous_page: URL of the previous page.
- next_page: URL of the next page.
- total_pages: Integer value of the total number of pages, starting at 1.
- pages: Array containing the URLs of all pages.
- truncate_start: Boolean. Set to true to truncate pagination at start.
- truncate_end: Boolean. Set to true to truncate pagination at end.
- truncate_pages: Array containing a list of pages to truncate.
- zero_based_index: Boolean. Set to true if your system is using zero based
indexing.
#}
{% set base = 0 %}
{% if zero_based_index %}{% set base = 1 %}{% endif %}
<nav role="navigation" aria-label="Pages"
class="bux-pagination{% if modifier %} bux-pagination--{{ modifier }}{% endif %}">
<ul class="bux-pagination__list">
{# Display previous link if we"re not on the first page. #}
{% if previous_page %}
<li class="bux-pagination__item">
{% include '@link' with {
base_class: "bux-pagination__link bux-pagination__link--previous",
link_url: previous_page,
attributes: {
'aria-label': 'Go to previous page'
}
} %}
</li>
{% endif %}
{# Display elipsis if truncate_start. #}
{% if truncate_start == true %}
<li class="bux-pagination__item">
<span class="bux-pagination__link bux-pagination__link--truncated" aria-hidden="true" role="presentation"></span>
</li>
{% endif %}
{% for key, page in pages %}
<li class="bux-pagination__item">
{% if current_page == key %}
{% include '@link' with {
base_class: "bux-pagination__link bux-pagination__link--current",
link_url: page,
link_text: key + base,
show_underline: false,
attributes: {
'aria-label': "Current page, page " ~ (key + base),
'aria-current': true
}
} %}
{% else %}
{% include '@link' with {
base_class: "bux-pagination__link",
link_url: page,
link_text: key + base,
show_underline: false,
attributes: {
'aria-label': "Page " ~ (key + base),
}
} %}
{% endif %}
</li>
{% endfor %}
{# Display elipsis if truncate_end. #}
{% if truncate_end == true %}
<li class="bux-pagination__item">
<span class="bux-pagination__link bux-pagination__link--truncated" aria-hidden="true" role="presentation"></span>
</li>
{% if show_last_page == true %}
<li class="bux-pagination__item">
{% include '@link' with {
base_class: "bux-pagination__link",
link_url: pages|last,
link_text: total_pages + base,
show_underline: false,
attributes: {
'aria-label': "Page " ~ (total_pages + base),
}
} %}
</li>
{% endif %}
{% endif %}
{# Display next link if we"re not on the last page. #}
{% if next_page %}
<li class="bux-pagination__item">
{% include '@link' with {
base_class: "bux-pagination__link bux-pagination__link--next",
link_url: next_page,
attributes: {
'aria-label': 'Go to next page',
}
} %}
</li>
{% endif %}
</ul>
</nav>
site_name_prefix: Office of
site_name: Learning Relations Excellence
site_slogan: Additional text or site slogan
address_1: 100 Building Name
address_2: 1 Oval Mall
city: Columbus
state: OH
zip: '43210'
contact_email: email@osu.edu
contact_phone: 614-292-OHIO
contact_tty: 614-688-8605
current_page: 2
previous_page: '#'
next_page: '#'
zero_based_index: true
total_pages: 5
pages:
- '#'
- '#'
- '#'
- '#'
- '#'
@mixin pagination($link-color: $scarlet, $active-bg: $gray-light-80) {
font-family: $sans;
margin-top: 4px;
.bux-pagination__list {
list-style: none;
display: flex;
justify-content: center;
align-items: center;
}
.bux-pagination__item {
}
.bux-pagination__link {
display: table-cell;
vertical-align: middle;
font-size: $ts-base;
font-weight: 600;
color: $link-color;
text-decoration: none;
height: 40px;
width: 40px;
padding: $sp-8;
text-align: center;
&:hover {
background-color: $active-bg;
color: $gray-dark-80;
}
&:focus {
position: relative;
outline: 2px solid $focus;
}
}
.bux-pagination__link--truncated {
&:hover {
background-color: $clear;
color: $link-color;
}
}
.bux-pagination__link--previous:before,
.bux-pagination__link--next:after {
font-family: $icon;
font-size: $ts-20;
line-height:0;
vertical-align: rem-calc(-5);
}
.bux-pagination__link--previous:before {
content: "\f004";
font-weight: 400;
}
.bux-pagination__link--next:after {
content: "\f005";
font-weight: 400;
}
.bux-pagination__link--truncated:before {
font-family: $icon;
content: "\f00d";
font-size: $ts-xs;
color: $gray-dark-80;
}
.bux-pagination__link--current {
background-color: $active-bg;
color: $gray-dark-80;
cursor: default;
border-bottom: $sp-4 $scarlet solid;
padding-bottom: $sp-4;
}
}
.bux-pagination {
@include pagination();
}
.bux-pagination--alt {
@include pagination($scarlet, $white);
}
.bux-pagination--reverse {
@include pagination($white, $white);
}
No notes defined.