Is this meant to address the confusing prev/next order?

The behavior of the Prev and Next methods on a Pages objects is probably the reverse of what you expect.

I added asc but the order is still reversed. How is this supposed to work?

It’s hard to know what’s happening without seeing your source, but the new configuration options work great.

Try it:

git clone --single-branch -b hugo-forum-topic-51239 https://github.com/jmooring/hugo-testing hugo-forum-topic-51239
cd hugo-forum-topic-51239
hugo server

(I forgot to save the password for my account. I am the same person though. Please forgive me for that mistake).

Test your example here @jmooring (but move the $p.Prev . before $p.Next . and replace the labels to be the correct way). The order is still reversed.

  1. I’m not sure what you’re doing, but the working example that I created for you behaves perfectly.
  2. I have no idea how the topic you referenced relates to the new page configuration options.

I suggest you clarify your problem and provide a working example that we can clone to reproduce your problem.

Also, instead of creating new accounts, reset your password by clicking on the “I forgot my password” link as shown below.

image

I played around with the test site there but the configuration did not work. I am saying you use that one as your testing ground because my code is similar and was lifted from that example. (I mean the confuguration has no effect on that code entirely).

Noted!

Yes, it does. This isn’t my first rodeo. Are you sure you’re running v0.133.0?

I am. The posts still are reversed. Hugo is messing with my mind rn

What does this mean? Take and post a screen capture of what you’re seeing when you test with the example that I provided.

Test site (smaller edits) Deleted

Changing the values (desc, asc). No change. As you can see, with desc for example, post 1 page 3 is previous and post 1 is next.

The behavior of the Prev and Next methods on a Pages objects is probably the reverse of what you expect.

And still it is that way.

1 Like

You are not doing what I asked you to do. Please help us to help you.

I made it clear that I am using a multipage section as an example Upload Files | Free File Upload and Transfer Up To 20 GB. Your initial example does not demonstrate the issue properly, but the current config setup with topic 40858 does (download file and open http://localhost:1313/en/posts/post-1/page/2/ on hugo server). I am starting to think one of us is not getting the other. (I should note I keep several of these test sites from you as backup for testing some new features).

Yes, you did, without any details, and there are several ways to handle multipage posts. Thank you for finally providing an example. This would have been much simpler to diagnose, and wasted less of your time and mine, had you done so earlier.

The new configuration options mentioned in the release notes apply to methods on a Page object, not methods on a Pages object.

Again, I blame the shortcomings of Hugo documentation. Thank you for your explanation Joe.

I’ve made a significant effort to improve the related pages.
https://github.com/gohugoio/hugoDocs/pull/2677

2 Likes

@jmooring when you navigate to /post-1/page/2/, the connection with the _index.md page is lost. Only the Next page shows up (no Previous). See it here Upload Files | Free File Upload and Transfer Up To 20 GB (remove .Reverse in posts/single.html and it shows up again)

You’re only reversing the regular pages.

Change this:

{{ $p := append .CurrentSection.Pages.ByWeight.Reverse (slice .CurrentSection) }}

To this:

{{ $p := (append .CurrentSection.Pages.ByWeight (slice .CurrentSection)).Reverse }}
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.