Muut Archive Legend
@Muut · Joined 9 years ago · 18337 posts · 3878 topics · 137 reputation
Badges
Recent posts
-
Header injection
· 10 years ago
Now I just get weird 404s. Where in the life cycle exactly are the metadata keys and values pulled from the header and rendered to HTML (https://learn.getgrav.org/content/headers#meta-page-headers)?
-
Header injection
· 10 years ago
Actually I have you the wrong event, should be onPageProcessed
-
Header injection
· 10 years ago
I did some more testing. If I stick to onPageInitialized, then it turns out I can activate plugins (e.g., setting the header pubmed.active: true). I assume that the expanded shortcode still gets cache
-
Header injection
· 10 years ago
Yeah, moving to onPageContentProcessed didn't change anything either. I dumped the $header at the top and $page->header() at the very end, and the changes make it, but no meta tags are outputted.
-
Header injection
· 10 years ago
That's the last line of code in that function, though. Not sure if there's something else I need to do to finalize it.
-
Header injection
· 10 years ago
That's what I do: $page = $this->grav['page']; $header = $page->header(); $header = new \Grav\Common\Page\Header((array) $header); $header->set('metadata.some.nested', 'value'); $page->hea
-
Header injection
· 10 years ago
You need to set the modified header back on the page object with: $page->header($header); However, if you wan this to persist to cache rather than doing this on every page requests for this page, t
-
Header injection
· 10 years ago
So while I can now access the headers, when I inject new 'metadata' subkeys and values, they don't get rendered in the final HTML. I'm currently hooked into onPageInitialized. I tried hooking to onPag
-
Header injection
· 10 years ago
I'm an idiot. I'd delete this whole thread if I could. I did this already in another plugin I did. The answer is $page = $this->grav['page']; /sighs/
-
Header injection
· 10 years ago
The filesource plugin hooks onto the onPageContentRawevent and gets the Page object via $event['page'], but that's not working at those other event points.