Is there a way to return full page in json format?

Hi,

I have created a plugin that returns the web content in json format. $page->content. Is there a way to return the complete page in json? the rendered version of the page and not only the content field?
Great CMS btw!
Best regards!

I’m not really following you and need some more info :slight_smile:

The page object itself is a PHP representation of an .md file. The content() method specifically is the primary method to access that content after it has been appropriately processed (HTML/Twig/plugins etc).

The content() method will return the fully ‘rendered’ view of the content assuming you have that markup in your content to begin with.

Grav however, renders the entire page through Twig template provided by the theme. This typically is what you view when you visit a website, and the {{ page.content() }} is rendered within that somewhere. The page object however doesn’t have any knowledge of this final step though. You can hook into Grav itself and use the onOutputRendered() event to get that output.

Hi,
yeah of course: The content() method will return the fully ‘rendered’ view of the content assuming you have that markup in your content to begin with.

Nevermind, i have to used the markup for my partials in twig to be rendered.
(:
Thanks for your description.

Glad to help!