I'm creating a custom module. This module displays public custom content without node and views . For this content custom page , I would like to add dynamic meta keyword and meta description .
I have read this excellent answer How do I add a meta tag in <head>...</head> section? and it said we can use
mymodulename_page_attachments(&$page)
and update variable
$page
But the meta contents are getting in a controller's method. For this raison, I would like to
pass the meta contents to mymodulename_page_attachments
hook.
How can I call and update $page
in my controller module to do this ? Or how can I generate meta in my controller ?