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

Support ordering pages and articles by metadata attributes and sorting functions #834

Closed

Conversation

davidmarble
Copy link
Contributor

This fixes #420.

This change makes the default sorting order for pages their filenames (new). The default sorting order for articles is still by slug (same as before). But you can tweak how either is sorted in your pelicanconf.py. For example:

PAGE_ORDER_BY = 'page-order'

In this case, just make sure that all pages have the metadata attribute 'page-order'.

Advanced: You could also use a sorting function. See the code for an example, as a sorting function is used to get filenames based on the source_path attribute of content.

…g functions. Default to order by slug for articles and order by filename for pages
@justinmayer
Copy link
Member

Hey David. Thanks for the contribution. Travis is reporting test failures; did the tests pass when you ran them on your system, as documented in the How to Contribute docs?

@davidmarble
Copy link
Contributor Author

Whoops! I'll take a look, fix, and re-submit.

@davidmarble
Copy link
Contributor Author

Those are errors in the existing master branch.

@justinmayer
Copy link
Member

How are you reaching the conclusion that there are test failures in the existing master branch? I'm not seeing that.

I am, however, seeing test failures related to this pull request

@avaris
Copy link
Member

avaris commented Apr 9, 2013

@davidmarble , I don't think this is correct. You are changing the key that is used for grouping/gathering translations, and this would lead to weird consequences (not to mention the current test error). Suppose I gave ARTICLE_ORDER_BY = 'author', this would result in marking every article with same author as translations of each other.

If you want to change the order of articles or pages, you should do it after process_translations is completed.

@davidmarble
Copy link
Contributor Author

Spent some time getting tests to pass on the existing master branch for Windows before coming back to this. Just submitted a pull request for that work.

I see what you're saying now about translations. I hadn't yet tried any translation work. Now that I have tests passing for master on both Windows and Linux, I'll consider some other ways of going about this feature.

@davidmarble davidmarble closed this Apr 9, 2013
@davidmarble davidmarble deleted the feature/page-ordering branch April 9, 2013 06:39
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

Successfully merging this pull request may close these issues.

Add metadata for custom page ordering
3 participants