picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.82k stars 616 forks source link

{{ page.raw_content }} not accessible #497

Closed paulomorais1981 closed 5 years ago

paulomorais1981 commented 5 years ago

Hi,

I'm using Pico 2.0 and trying to access the {{ page.raw_content }} variable in twig, but it's getting empty content.

Is this variable really workable?

Thx.

PhrozenByte commented 5 years ago

The page variable is for illustration purposes, you still need to define that variable. If you want to access the current page's raw contents, use

{{ current_page.raw_content }}

If you're within a iteration of the {{ pages }} list, you can use it like:

{% for page in pages %}
    {{ page.raw_content }}
{% endfor %}

Also see the Twig documentation.

paulomorais1981 commented 5 years ago

Nice. It worked. Need correction on Pico Docs.