Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Rendering page content on another page

Solved by pamtbaau View solution

Started by Josh 5 years ago · 2 replies · 585 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 Jerry Hunt, 4 days ago
2 82 11 hours ago
General · by pamtbaau, 16 hours ago
1 53 16 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 347 5 days ago
General · by Duc , 5 days ago
3 41 5 days ago