Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog posts order differs in side-nav vs list #1197

Open
chalin opened this issue Aug 24, 2022 · 4 comments · Fixed by #1200
Open

Blog posts order differs in side-nav vs list #1197

chalin opened this issue Aug 24, 2022 · 4 comments · Fixed by #1200
Labels
bug Something isn't working e0-minutes Effort < 60 min e1-hours p3-low

Comments

@chalin
Copy link
Collaborator

chalin commented Aug 24, 2022

To reproduce, create a new project:

$ hugo new site myproject
$ cd myproject
$ npm install --save-dev google/docsy autoprefixer postcss-cli postcss
$ echo 'theme = "docsy"' >> config.toml
$ echo 'themesDir = "node_modules"' >> config.toml

Then create two posts with the same date, such as:

  • blog/post-1.md:
    ---
    title: Learn
    date: 2022-08-24
    ---
  • blog/post-2.md:
    ---
    title: Go
    date: 2022-08-24
    ---

Build and/or serve the site and visit /blog. This is what you'll see:

image

Notice how the order of the posts differs.

@LukeTimeWalker
Copy link
Contributor

It seems that the entries in the side-navigation are sorted alphabetically, whereas the entries in the list are sorted in reverse alphabetical order. Maybe it's helpful...
grafik

@chalin
Copy link
Collaborator Author

chalin commented Oct 8, 2022

Reopening because this didn't fix the issue for me. (I'll post more details as soon as I can.)

@chalin chalin reopened this Oct 8, 2022
@chalin
Copy link
Collaborator Author

chalin commented Oct 8, 2022

This is what happens now: the main list of posts is in ascending order. It used to be in descending order (so that the most recent post was first).

image

Or, if all posts are in the same year:

image

So #1200 will need to be reverted.

@chalin
Copy link
Collaborator Author

chalin commented Oct 8, 2022

I think that the order of the posts in the blog page listing is correct. It'll be tricky to fix in the navbar (that code is quite complicated already). Maybe it's a "bug" in the Hugo sort function? That would require some careful testing, and I don't have time for that atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working e0-minutes Effort < 60 min e1-hours p3-low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants