-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
Sorting pages using a customer header isn't honoured. #657
Comments
I'm not seeing anything obvious here... if it works with I know it's not helpful, but maybe double check everything for typos? Copy and paste @PhrozenByte Do you have any thoughts on this? |
Check for typos and upper/lowercase (especially when the meta header was registered using a plugin's |
I figured out what's causing it. For next and previous buttons I had added a sorting configuration in the config.yml as per this discussion.
This is overriding my |
To be honest, what it sounds like is that your original code just didn't work. It only appeared to work because you were already sorting pages by And, I'm realizing now that I'm looking at the docs, that your syntax for It should be: {% for page in pages|sort_by(['meta', 'Number'])%} Not: {% for page in pages|sort_by("page.meta.Number")%} So, why don't you give that a try and see if it behaves right. 😉 |
It does. Crazy! I don't know how I got the idea of using Thanks for the help. |
No worries. It happens. 😉 It is an odd syntax. On the technical side, this is because you're giving a Pico function some strings as arguments rather than reading them inside of Twig. Don't feel too bad though, me and @PhrozenByte didn't catch that one either. 😅 |
I am sorting pages (posts) per a meta header.
Earlier, the sorting was done by
Position
and it worked. I later changed it toCatposition
and added this header to all the required pages numbered them correctly. But for some reason, sorting byCatposition
just does not work. Posts are listed alphabetically. However, the moment I revert the sorting code topage.meta.Position
, lists are sorted as per thePosition
. It is as if something is syntactically wrong with the code containingCatposition
even though it is an exact copy with a change in the header. Any idea what could be wrong?The text was updated successfully, but these errors were encountered: