diff --git a/_docs/creating-content.md b/_docs/creating-content.md index 7087251..29276fc 100644 --- a/_docs/creating-content.md +++ b/_docs/creating-content.md @@ -89,7 +89,7 @@ If you want to use Pico as a blogging software, you probably want to do somethin
blog.md
in your content
folder and set its Template
meta header to e.g. blog
. Also create a blog.twig
in your theme directory. This template will show a list of your articles, so you probably want to do something like this:
- {% raw %}{% for page in pages %}
+ {% raw %}{% for page in pages|sort_by("time")|reverse %}
{% if page.id starts with "blog/" %}
<div class="post">
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
@@ -100,10 +100,7 @@ If you want to use Pico as a blogging software, you probably want to do somethin
{% endfor %}
{% endraw %}
$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
.
- {% if not page starts with "blog/" %}...{% endif %}
to the navigation loop.
+ 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 ({% for page in pages %}...{% endfor %}}
) in your themes index.twig
.