PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
257 stars 49 forks source link

[QUESTION] Sorting pages #57

Closed STOWouters closed 10 years ago

STOWouters commented 10 years ago

I have the following snippet in my config.php:

$config['date_format'] = 'j F Y';
$config['pages_order_by'] = 'date';
$config['pages_order'] = 'desc';

And the following meta tags were applied:

<!--
Title: file1
Date: 17 December 2013
-->
<!--
Title: file2
Date: 24 December 2013
-->
<!--
Title: file3
Date: 10 February 2014
-->

So, the files should appear in the following precedence: file3, file2, file1. However, I got file2, file1, file3. It seems that the sorting doesn't take the years into account, or did I do something wrong?

james2doyle commented 10 years ago

Try using the "Y/m/d" format in the meta. Then format that on the frontend with the Twig date filter.

STOWouters commented 10 years ago

Thanks, that did it:

{{ current_page.meta.date|date(config.date_format) }}