I want to add a meta description to a custom module ‘mymodule’, but this doesn’t load as expected.
The problem is in the active trail, when menu_get_active_trail is called inside array 1 the router_path = node/% and the title is page not found.
How can the active trail be fixed?
This works on other sites.
function mymodule_html_head_alter(&$head_elements) { // menu_get_object with load function at position 2 if ($myentity = menu_get_object('myentity', 2)) { dpm(menu_get_active_trail()); $head_elements['meta_description'] = array( '#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array( 'name' => 'description', 'content' => $myentity->name, ), ); } }