hexojs / hexo-generator-index

Index generator plugin for Hexo.
MIT License
53 stars 45 forks source link

Are there more order options? #58

Closed ZhouYingSASA closed 3 years ago

ZhouYingSASA commented 3 years ago

I noticed that the order option has been made into _config.yml, but I can't find more order options from hexo's official document.

# order_by: Posts order. (Order by date descending by default)
  order_by: -date

Does it seem to be less humanity for only ordering by created date?

Due to my poor JS knowledge, if I miss more order options, can u update the hexo doc plz?

paddyredbeard commented 3 years ago

I agree, it would be very helpful to know what options other than -date may be used. Nothing I have tried has had any effect.

ZhouYingSASA commented 3 years ago

I agree, it would be very helpful to know what options other than -date may be used. Nothing I have tried has had any effect.

As I know, most other sortings are realized by modifying the js file by users ourselves..

jiangtj commented 3 years ago

Api Document https://hexojs.github.io/warehouse/Query.html#sort

Sort is to sort the object properties (Page-Variables), refer to the above document for details, and the following is test case

https://github.com/hexojs/hexo-generator-index/blob/1a637a04ea809d127a771810c30fbb18e08ca388/test/index.js#L19-L23 https://github.com/hexojs/hexo-generator-index/blob/1a637a04ea809d127a771810c30fbb18e08ca388/test/index.js#L88-L128

ZhouYingSASA commented 3 years ago

@jiangtj I noticed there is a new project forked from this one has solved my trouble. Still thx for giving help.