mlampros / mlampros.github.io

My personal blog
http://mlampros.github.io/
Other
5 stars 3 forks source link

Newer button doesn't seem to work on page 2:) #1

Closed BDHU closed 6 years ago

BDHU commented 6 years ago

The Newer button at the bottom of page 2 doesn't seem to lead you back to the previous page:)

mlampros commented 6 years ago

@BDHU,

I'm sorry for the late reply. Which newer button do you mean? Can you attach the url of the web page.

BDHU commented 6 years ago

The page link is here. When you scroll down to the bottom of the page you can see the Older and Newer button to reach old and new posts. However the Newer button doesn't have any effect as clicking it will still remain on http://mlampros.github.io/page2/. I have this exact same issue and it appears something is wrong with index.html:)

mlampros commented 6 years ago

Thanks for making me aware of this. Moreover, when I click more than once the older button it gives '404: Page not found' although there are still older blogs in the archives section. You also have a blog based on the lanyon theme. I have to search on the web for this one. If you find a solution to the issue I'll be glad if you post it here too. At least someone (currently) has the option to navigate through the archives section based on the dates.

mlampros commented 6 years ago

@BDHU,

I found the issue and thanks for the hint to look at the index.html page. I had to look to the initial blog that I wrote back in 2016 and especially the following two links helped to resolve this one here and here (it was one of the blogs that I used to set up mine). I replaced the following script in the index.html page,


<div class="pagination">
  {% if paginator.next_page %}
    <a class="pagination-item older" href="{{ site.baseurl }}page{{paginator.next_page}}">Older</a>
  {% else %}
    <span class="pagination-item older">Older</span>
  {% endif %}
  {% if paginator.previous_page %}
    {% if paginator.page == 2 %}
      <a class="pagination-item newer" href="{{ site.baseurl }}">Newer</a>
    {% else %}
      <a class="pagination-item newer" href="{{ site.baseurl }}page{{paginator.previous_page}}">Newer</a>
    {% endif %}
  {% else %}
    <span class="pagination-item newer">Newer</span>
  {% endif %}
</div>

with this one,


<div class="pagination">
  {% if paginator.next_page %}
    <a class="pagination-item older" href="{{ "/" | relative_url }}page{{paginator.next_page}}">Older</a>
  {% else %}
    <span class="pagination-item older">Older</span>
  {% endif %}
  {% if paginator.previous_page %}
    {% if paginator.page == 2 %}
      <a class="pagination-item newer" href="{{ "/" | relative_url }}">Newer</a>
    {% else %}
      <a class="pagination-item newer" href="{{ "/" | relative_url }}page{{paginator.previous_page}}">Newer</a>
    {% endif %}
  {% else %}
    <span class="pagination-item newer">Newer</span>
  {% endif %}
</div>

and know it works as expected. Thanks again for making me aware of this issue.

BDHU commented 6 years ago

That solves my problem. I also find official documentation regarding pagination in Jekyll if the problem appears later.

mlampros commented 6 years ago

thanks for the documentation web-link. I close the issue for now, feel free to reopen it.