Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Rendering page content on another page

Solved by pamtbaau View solution

Started by Josh 5 years ago · 2 replies · 827 views
5 years ago

I'm having a basic problem of not being able to display page content on another page. In a page .md file I have this:

YAML
process:
    markdown: true
    twig: true
---
{{ page.find('/05.test').content }} 

But it's not rendering the 'test' page content. What am I doing wrong?

5 years ago Solution

@skipper, Try leaving out the number. The parameter of find is a url not the folder name.

See https://learn.getgrav.org/17/api#class-grav-common-page-page

find( string $url , bool $all=false )

You should also add the |raw filter, else the content will be auto-escaped.

TWIG
{{ page.find('/typography').content | raw }}

Suggested topics

Topic Participants Replies Views Activity
General · by Andy Miller, 7 days ago
0 112 7 days ago
General · by lynbor, 1 month ago
3 439 2 weeks ago
General · by lynbor, 3 weeks ago
7 562 2 weeks ago
General · by Harry, 2 weeks ago
0 161 2 weeks ago
General · by Old Man Umby, 1 month ago
2 309 3 weeks ago