YAML data from page object


is there a function in the kirby core to convert a page object to YAML data like $page->create but without writing it to disk?
Something like $page->create without URI and Template?

I need it inside a page.update.hook to check if $page and $oldPage are the same/something was changed.
Maybe there is a better way to check this?


Maybe data::encode ?

After your update: maybe converting $page and $oldPage to arrays, and then use array_diff is a better solution?

1 Like

I’ll try so now because data::encode($page, 'yaml') (also for $oldPage) gives back just nothing.

Thank you!

You probably want to compare the content of those pages, so it would make more sense to use the content object:

1 Like

Works great!
Thank you for the helpful hints!