From b6e2f95d74ef108ad86b344c01f0ddfb39e40a7c Mon Sep 17 00:00:00 2001 From: dipohl Date: Tue, 5 Dec 2023 23:38:32 +0100 Subject: [PATCH] Code Example was not compatible with new Twig version 3 --- _docs/creating-content.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/_docs/creating-content.md b/_docs/creating-content.md index eb1b7045..8a3d66de 100644 --- a/_docs/creating-content.md +++ b/_docs/creating-content.md @@ -108,12 +108,14 @@ If you want to use Pico as a blogging software, you probably want to do somethin
  • Create the new Twig template blog-index.twig (the file name must match the Template meta header from Step 2) in your theme directory. This template probably isn't very different from your default index.twig (i.e. copy index.twig), it will create a list of all your blog articles. Add the following Twig snippet to blog-index.twig near {% raw %}{{ content }}{% endraw %}: -{% raw %}
    {% for page in pages("blog")|sort_by("time")|reverse if not page.hidden %}
    -    <div class="post">
    -        <h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
    -        <p class="date">{{ page.date_formatted }}</p>
    -        <p class="excerpt">{{ page.description }}</p>
    -    </div>
    +{% raw %}
    {% for page in pages("blog")|sort_by("time")|reverse %}
    +    {% if not page.hidden %}
    +        <div class="post">
    +            <h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
    +            <p class="date">{{ page.date_formatted }}</p>
    +            <p class="excerpt">{{ page.description }}</p>
    +        </div>
    +    {% endif %}
     {% endfor %}
    {% endraw %}