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 two parameters to post-list directive to allow for sorting posts #1635

Merged
merged 5 commits into from Mar 14, 2015

Conversation

@erdgeist
Copy link
Contributor

erdgeist commented Mar 13, 2015

I have added the sort and sortnumparameters to the post-list directive, so the order of posts can be changed from their default. sort sorts alphabetically, sortnum numerically, so I can either sort all posts by their title or manually put priorities to posts to set their order.

@tomster

This comment has been minimized.

perhaps filtered_timeline.sort(key=lambda post: int(post.meta[lang].get(sortnum, 0)))

@Kwpolska

This comment has been minimized.

Copy link
Member

Kwpolska commented Mar 13, 2015

You could try merging the two options by using natsort.

@Kwpolska Kwpolska added this to the v7.3.2 milestone Mar 13, 2015
@Kwpolska

This comment has been minimized.

Copy link
Member

Kwpolska commented Mar 14, 2015

Please add:

  • erdgeist at erdgeist dot org to your github e-mails,
  • yourself to AUTHORS.txt,
  • a description of the change to CHANGES.txt
@@ -1659,6 +1659,10 @@ The following options are recognized:
Reverse the order of the post-list.
Defaults is to not reverse the order of posts.

* ``sort``: string
Sort post list by one of each post's attributes, usually ``title`` or a custom ``prio``.

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Mar 14, 2015

Member

Why not call it priority?

@Kwpolska Kwpolska self-assigned this Mar 14, 2015
@Kwpolska

This comment has been minimized.

Copy link
Member

Kwpolska commented Mar 14, 2015

Merging and renaming prio to priority for readability.

Thank you for your contribution!

@Kwpolska Kwpolska merged commit 95dfe85 into getnikola:master Mar 14, 2015
2 checks passed
2 checks passed
continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Kwpolska added a commit that referenced this pull request Mar 14, 2015
Add [a] parameter to post-list directive to allow for sorting posts
Kwpolska added a commit that referenced this pull request Mar 14, 2015
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
@erdgeist erdgeist deleted the erdgeist:sorted-post-lists branch Mar 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.