This is a nice module but the lacks of views support lets it down.
I've currently hard coded my meta tags into the page template so at least views gets some tags. That's a reasonable route for static tags anyway. That means I don't use the default tags at all. So my work around is to use that as the extra tags for views. What I propose then is that the page_process hook in this module should check if $tags is null and if so force loading of the default tags. All the page types then do not have the box ticked to include the defaults. Common tags are either in the page template or you copy then to each page type.
In int_meta.module after
function int_meta_preprocess_page(&$variables) {
$tags = int_meta_get_metatags();
insert
if (empty($tags)) {
$tags = int_meta_load_tags(); //force load of default tags whatever
if (module_exists('token')) { //Copy from node bit to load global tokens
foreach ($tags as $key => $tag) {
if (!isset($tag->type)) {
$tags[$key]->name = token_replace($tag->field);
if (!empty($tag->values)) {
foreach ($tag->values as $i => $value) {
$tags[$key]->values[$i] = token_replace($value);
}
}
}
}
}
}
Of course only global tokens work so my next task is to see if the view can generate a token.
I think this is a reasonable fix. Default tags then appear on all pages like they should do. Page type tags can still include the default if you want them too or you can can use the default just for views.
Comments
Comment #1
malc_b commentedThe other option, from another post, would be to define global tags first and then allow them to be overwritten. That is, everything gets the global tags, then in pages where they are turned off the global tags are delete. Page type tags that match the global types overwrite the global.
Comment #2
malc_b commentedI've decided to drop this idea on my site. Instead I have opted to use page-xxx.tpl.php as a route to define custom meta tags for views and taxonomy. Each page-xxx.tpl.php defines $myheader which I have in the main page.tpl.php. That defaults to null so prints nothing on most pages. And at the end of these custom pages I just include the normal page.tpl.php file. If anyone wants to use this route available pages are:
page-taxonomy.tpl.php - the taxonomy page
page-xxx.tpl.php - xxx is 1st argument, so for /views/something the xxx = views
page-frontpage.tpl.php - the frontpage