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

Add ability to change sort direction for date #57

Closed
kevinlang opened this issue Apr 9, 2021 · 2 comments
Closed

Add ability to change sort direction for date #57

kevinlang opened this issue Apr 9, 2021 · 2 comments

Comments

@kevinlang
Copy link

kevinlang commented Apr 9, 2021

I see this documentation here: https://lumeland.github.io/creating-pages/searching/

And I see that date is the default sort. As far as I can tell it dates in ascending order (oldest first). I would like to sort in descending order (newest first), but could not find how to.

Perhaps looking something like:

search.pages("type=post", "date=desc")

Cheers,

@kevinlang
Copy link
Author

I found how to do it, in my case just using nunjucks built-in reverse function.

search.pages("type=post", "date=desc") | reverse

May be worth adding docs, though.

@oscarotero
Copy link
Member

ATM, the sort argument only accepts the field name (date by default), but it's a good idea to include support for asc/desc. I'll work on that. Thanks!

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

No branches or pull requests

2 participants