Created
February 11, 2016 13:11
-
-
Save jeonghwan-kim/113be09ca20860d67b8c to your computer and use it in GitHub Desktop.
jekyll-pagination-links.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Pagination Links --> | |
{% if paginator.total_pages > 1 %} | |
<div class="pagination"> | |
{% if paginator.previous_page %} | |
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a> | |
{% else %} | |
<span>« Prev</span> | |
{% endif %} | |
{% for page in (1..paginator.total_pages) %} | |
{% if page == paginator.page %} | |
<em>{{ page }}</em> | |
<!-- 1번 링크는 루트 링크로 설정 --> | |
{% elsif page == 1 %} | |
<a href="/">{{ page }}</a> | |
{% else %} | |
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a> | |
{% endif %} | |
{% endfor %} | |
{% if paginator.next_page %} | |
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next »</a> | |
{% else %} | |
<span>Next »</span> | |
{% endif %} | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment