Pagination now works for index.html files in subfolders. Links to next page consider baseurl now. (#764)
This commit is contained in:
parent
f4e75fe640
commit
696afd7ef2
2 changed files with 12 additions and 11 deletions
|
@ -28,7 +28,7 @@
|
||||||
{% if page.header.overlay_color or page.header.overlay_image %}
|
{% if page.header.overlay_color or page.header.overlay_image %}
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<h1 class="page__title" itemprop="headline">
|
<h1 class="page__title" itemprop="headline">
|
||||||
{% if paginator %}
|
{% if paginator and site.paginate_show_page_num %}
|
||||||
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
|
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[site.locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
|
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
{% if paginator.total_pages > 1 %}
|
{% if paginator.total_pages > 1 %}
|
||||||
<nav class="pagination">
|
<nav class="pagination">
|
||||||
|
{% assign first_page_path = site.paginate_path | replace: 'page:num', '' | replace: '//', '/' | absolute_url %}
|
||||||
<ul>
|
<ul>
|
||||||
{% comment %} Link for previous page {% endcomment %}
|
{% comment %} Link for previous page {% endcomment %}
|
||||||
{% if paginator.previous_page %}
|
{% if paginator.previous_page %}
|
||||||
{% if paginator.previous_page == 1 %}
|
{% if paginator.previous_page == 1 %}
|
||||||
<li><a href="{{ '/' | absolute_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
<li><a href="{{ first_page_path }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{ '/page' | absolute_url }}{{ paginator.previous_page | append: '/' }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
<li><a href="{{ site.paginate_path | replace: ':num', paginator.previous_page | replace: '//', '/' | absolute_url }}">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</span></a></li>
|
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_previous | default: "Previous" }}</span></a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% comment %} First page {% endcomment %}
|
{% comment %} First page {% endcomment %}
|
||||||
{% if paginator.page == 1 %}
|
{% if paginator.page == 1 %}
|
||||||
<li><a href="#" class="disabled current">1</a></li>
|
<li><a href="#" class="disabled current">1</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{ '/' | absolute_url }}">1</a></li>
|
<li><a href="{{ first_page_path }}">1</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% assign page_start = 2 %}
|
{% assign page_start = 2 %}
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
|
|
||||||
{% for index in (page_start..page_end) %}
|
{% for index in (page_start..page_end) %}
|
||||||
{% if index == paginator.page %}
|
{% if index == paginator.page %}
|
||||||
<li><a href="{{ '/page' | absolute_url }}{{ index | append: '/' }}" class="disabled current">{{ index }}</a></li>
|
<li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | absolute_url }}" class="disabled current">{{ index }}</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% comment %} Distance from current page and this link {% endcomment %}
|
{% comment %} Distance from current page and this link {% endcomment %}
|
||||||
{% assign dist = paginator.page | minus: index %}
|
{% assign dist = paginator.page | minus: index %}
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
{% comment %} Distance must be a positive value {% endcomment %}
|
{% comment %} Distance must be a positive value {% endcomment %}
|
||||||
{% assign dist = 0 | minus: dist %}
|
{% assign dist = 0 | minus: dist %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href="{{ '/page' | absolute_url }}{{ index | append: '/' }}">{{ index }}</a></li>
|
<li><a href="{{ site.paginate_path | replace: ':num', index | absolute_url }}">{{ index }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
@ -54,12 +55,12 @@
|
||||||
{% if paginator.page == paginator.total_pages %}
|
{% if paginator.page == paginator.total_pages %}
|
||||||
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
|
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{ '/page' | absolute_url }}{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
|
<li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | absolute_url }}">{{ paginator.total_pages }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% comment %} Link next page {% endcomment %}
|
{% comment %} Link next page {% endcomment %}
|
||||||
{% if paginator.next_page %}
|
{% if paginator.next_page %}
|
||||||
<li><a href="{{ '/page' | absolute_url }}{{ paginator.next_page }}/">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li>
|
<li><a href="{{ site.paginate_path | replace: ':num', paginator.next_page | replace: '//', '/' | absolute_url }}">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</a></li></a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li>
|
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[site.locale].pagination_next | default: "Next" }}</span></a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue