LoveIt icon indicating copy to clipboard operation
LoveIt copied to clipboard

[BUG] posts on homepage are not sorted in the order of creation date (latest to oldest)

Open rajanpanchal opened this issue 4 years ago • 6 comments

Describe the bug 描述你遇到的错误

The posts appear on home page are not sorted by latest to oldest

Expected behavior 期待的行为

New posts should appear on top

Screenshots 屏幕截图

Build Environment 构建环境

  • OS: [e.g. Windows 10, macOS, Ubuntu]
  • Theme version/commit [latest]
  • Hugo version [latest]

Please try to use Hugo extended version before opening the issue

Preview Environment

Additional Information 补充信息

Configuration files or front matter code... 配置文件或者前置参数的代码...

rajanpanchal avatar Aug 04 '20 12:08 rajanpanchal

I am having the same problem but doesn't look like the author is responding to any of the bugs or queries.

Amir-Mir avatar Aug 24 '20 13:08 Amir-Mir

I am having the same problem but doesn't look like the author is responding to any of the bugs or queries.

I fixed it by myself.

rajanpanchal avatar Aug 24 '20 13:08 rajanpanchal

Can you share your fix please?

Amir-Mir avatar Aug 24 '20 13:08 Amir-Mir

Can you share your fix please?

In layouts/index.html, modify the line where it displays posts to:

{{- range $pages.Pages.ByDate.Reverse -}}

rajanpanchal avatar Aug 24 '20 14:08 rajanpanchal

Fantastic!....thank you so much for sharing.

Amir-Mir avatar Aug 24 '20 14:08 Amir-Mir

Can you share your fix please?

In layouts/index.html, modify the line where it displays posts to:

{{- range $pages.Pages.ByDate.Reverse -}}

This is looking good, you can do PR for it

Edited: Anyway, I have no problem about this. I have tried to replace my oldest posts with the newest date and it will always be attached to the newest posts.

khusika avatar Nov 19 '20 07:11 khusika