spanezz / staticsite

Static site generator
GNU General Public License v3.0
46 stars 7 forks source link

Allow sorting pages by destination url #14

Closed DonKult closed 6 years ago

DonKult commented 6 years ago

Lets say you have a sort-of diary/notes/junkyard with the filelayout diary/<year>/<month>/<day>.md.

Directory listing only shows the contents of individual months, but if you want an index of all entries sorted to have the most recent at the top you have a problem: As your diary pre-dates ssite/is (not) auto-generated/… those files have no header to speak of (so not sortable by date) and there is also no established title format you could sort by (if they have a title at all). The only thing they can be reasonably be sorted by seems to be the URL of the entry.

So this PR introduces the url keyword to be able to sort by the dst_link of a page rather than any (non-existent) meta data. Your problem is hence solved by {% for page in site_pages(path="diary/*/*/*", sort="-url") %}.