raignarok in IRC gave me this idea for this feature so I am documenting it.
:page-order: # metadata for pagespage-order metadata that doesn't cast properly to a number throws a warning and discards the metadatapage-order metadata go first in the list, sorted in ascending numerically.This will probably go nicely with #400 and #220 since pages and the location of articles will be way more flexible.
+1 :)
Ok! Its on my todo list
Included for 3.1
+1 - would be lovely to have this feature as well as already mentioned #400 ad #200. Very helpful for project sites or sites of ogrganisations.
@tbunnyman: Do you think you can find some time to work on this issue? Just trying to plan the next release. :smile:
I've just added a pull request with a fix.
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.
This new pull request seems to do it. Hopefully it's accepted.
This interest me and when I will have a little time I may rework this. Still, I would like to propose a slightly different implementation:
I've merged @davidmarble work and @malept tests against current master in #1348
Works like a charm for me.
Feature merged and will be included in Pelican 3.5. Thanks to everyone for their input, contributions, and patience.
It may sounds exaggerated, but this is a HUGE improvement to non-blog site projects in Pelican. This feature deserves a better explanation in the docs, maybe a full paragraph. Thank you very much!
I gave this a try and it didn't work! Then I realized that is because the template which I am using also sort the pages!
Most helpful comment
It may sounds exaggerated, but this is a HUGE improvement to non-blog site projects in Pelican. This feature deserves a better explanation in the docs, maybe a full paragraph. Thank you very much!