Closed DJoerger closed 4 years ago
Try Pico's conent
Twig filter: {{ page.id|content }}
Also see Pico's user docs at http://picocms.org/docs/#themes:
To get the parsed contents of a page, pass its unique ID to the content filter (e.g.
{{ "sub/page"|content }})
.
Hi, thanks for your answer! I've tried {{ "blog/"|content }} before, but it didn't worked...
That's because blog/
is no page ID, the Twig filter expects a page ID (like sub/page
or blog/my-first-article
).
Ah, yes, but i want to show the content of the last five blog articles. Single page content is not what i'm searching for.
This has nothing to do with the content
Twig filter, but with your loop; you simply have to iterate just the 5 pages you want to.
{% for page in pages|sort_by("time")|reverse if page.id starts with "blog/" and not page.hidden %}
{% if loop.index <= 5 %}
<div class="post">
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
<p class="date">{{ page.date_formatted }}</p>
<p class="entry">{{ page.id|content }}</p>
</div>
{% endif %}
{% endfor %}
Many thanks, now i've got it! :)
Nest step: have a look how good Pico performs with a few hundred blog entries. ^^
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1:
Hello, i'm a beginner with not much coding knowledge (i know, best precondition ;) ) and try to setup Pico as a blog. Pico is up and running, everything works fine, except one thing:
I try to show the last blog posts with their content (not only description) on the front page and i thought {{ page.content }} would do the job...
My code looks like:
` {% for page in pages|sort_by("time")|reverse %} {% if page.id starts with "blog/" and not page.hidden %}
{{ page.title }}
{{ page.date_formatted }}
{{ page.content }}
And simply doesn't work. I can't find anything about this in the docs, so i hope someone can help me out.
With best regards Denis