diff --git a/content-sample/index.md b/content-sample/index.md index 218646a..8d4474e 100644 --- a/content-sample/index.md +++ b/content-sample/index.md @@ -117,7 +117,7 @@ something like the following: This template will show a list of your articles, so you probably want to do something like this: ``` - {% for page in pages %} + {% for page in pages|sort_by("time")|reverse %} {% if page.id starts with "blog/" %}

{{ page.title }}

@@ -127,16 +127,10 @@ something like the following: {% endif %} {% endfor %} ``` -4. Let Pico sort pages by date by setting `$config['pages_order_by'] = 'date';` - in your `config/config.php`. To use a descending order (newest articles - first), also add `$config['pages_order'] = 'desc';`. The former won't affect - pages without a `Date` meta header, but the latter does. To use ascending - order for your page navigation again, add Twigs `reverse` filter to the - navigation loop (`{% for page in pages|reverse %}...{% endfor %}`) in your - themes `index.twig`. -5. Make sure to exclude the blog articles from your page navigation. You can +4. Make sure to exclude the blog articles from your page navigation. You can achieve this by adding `{% if not page starts with "blog/" %}...{% endif %}` - to the navigation loop. + to the navigation loop (`{% for page in pages|reverse %}...{% endfor %}`) + in your themes `index.twig`. ## Customization