Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Rendering page content on another page

Solved by pamtbaau View solution

Started by Josh 5 years ago · 2 replies · 996 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 themetman, 23 hours ago
2 40 16 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago