Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

BUG: Previous/next for blog inconsistent with pagination #163

Closed
kdbruin opened this issue Jul 14, 2020 · 2 comments · Fixed by #154
Closed

BUG: Previous/next for blog inconsistent with pagination #163

kdbruin opened this issue Jul 14, 2020 · 2 comments · Fixed by #154

Comments

@kdbruin
Copy link
Contributor

kdbruin commented Jul 14, 2020

Bug Report

Describe the bug

The previous/next buttons underneath a blog are in reverse order compared to the pagination. With pagination the left button goes to the previous page (more recent posts) and the right button to the next page (older posts). Underneath a blog page the left button will go to the next (older) article and the right button goes to the previous (newer) article.

To Reproduce

Visible when multiple blog posts are available that generate at least 3 pages.

Expected behavior

The left button underneath the blog should go to the newer article, the right button to the older article.

Screenshots

On the blog index page the order of articles is shown including the previous/next buttons:

Screenshot 2020-07-14 at 07 16 46

The next image shows the buttons underneath the middle article. The order does not match that of the index page:

Screenshot 2020-07-14 at 07 17 02

Environment

  • Hugo Version: [0.73]
  • Browser and Version: [Safari 13.1.1]
  • Platform: [Desktop + Mobile]
  • Link to Project:

Additional context

@pacollins
Copy link
Owner

I understand what you are saying, but I think it is a linguistic issue.

When you are on a list of pages, you are going to the next page (because there is only one page as an option).

When you are on a single post, you are going to the previous post if you are going back in time (because posts are time-based).

Here are the relevant templates for the theme.

For Single Pages:

<!-- Pagination -->
<div class="pagination">
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}" class="button"><div class="previous"><div>Previous</div></div></a>
{{ end }}
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}" class="button"><div class="next"><div>Next</div></div></a>
{{ end }}
</div>

For List Pages:

<div class="pagination">
{{ if .PrevInSection }}
<a href="{{ .PrevInSection.RelPermalink }}" class="button"><div class="previous"><div>{{ .PrevInSection.Title }}</div></div></a>
{{ end }}
{{ if .NextInSection }}
<a href="{{ .NextInSection.RelPermalink }}" class="button"><div class="next"><div>{{ .NextInSection.Title }}</div></div></a>
{{ end }}
</div>


That being said, I will look at some other themes to see what they do.

@pacollins
Copy link
Owner

After looking at this further, I agree.

Single page pagination left should go to newer posts while right should go to older posts as it does with the list pagination.

I will include this in #154, which I hope to merge by the end of this week.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants