How to access frontmatter value in a onPageProcessed event?

in my theme i have onPageProcessed event, i can access my theme config options, but i want to access my page frontmatter values, i add $header = $page->header(); when i dump, i can see the values, but how to access them in a condition for instance ?

ok i can access them with a foreach, but what i don’t understand is that $header have all the pages frontmatter ? how can i access only values belong to the page ?

$page->header() only the current page’s frontmatter.

thanks, but why when i dump $header i see all page’s frontmatter. If i echo $value from a specific key in my foreach it prints all value from different pages

onPageProcessed is called on all pages. You can check it’s the current page by checking its route and comparing to the current route stored in $grav['uri']

oh! thanks, i will try that, thanks again

i try that code

$route = $page->route();

if ($uri == $route) {
 // do stuff

it works but not with home page because $route is /home and $uri is /