Posted by nagalatha on January 31, 2008 at 10:58am
8 followers
| Project: | Nodewords: D6 Meta Tags |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
i am using nodewords module..
i have created a website which is having pages generated from view module...
i am able to get the meta tags for my normal static pages but not for the page generated from view module..
wht might be the reason...
need serious help..... pleaseeeee..
Comments
#1
What about fixing this issue?
#2
Same here. Any info on this please?
#3
Nevermind, i've fixed this with drupal_set_html_head()
<?php
if($node->nodewords["description"]) {
$metaDescription = $node->nodewords["description"];
drupal_set_html_head('<meta name="description" content="'.$metaDescription.'" />');
}
if($node->nodewords["keywords"]) {
$metaKeywords = $node->nodewords["keywords"];
drupal_set_html_head('<meta name="keywords" content="'.$metaKeywords.'" />');
}
?>
#4
I found that the meta tags are set for some views, but not all. I think the problem is due to the fact that the views detection code is run from nodewords_init(), and is based on a direct database query to look for views in the {views_display} table. However, this table doesn't contain information about ALL views, only those that have been manually created. This does not include those views that are provided by other modules.
I fixed this by using nodewords_views_pre_render() to to add nodewords to the page:
<?phpfunction nodewords_views_pre_render(&$view) {
// Don't really do anything with the view. This is just a pretense to insert a breadcrumb.
$curpath = $_REQUEST['q'];
$curpath = drupal_get_normal_path($curpath);
// Check to see if the view path matches the current path.
$viewpage = FALSE;
foreach ($view->display as $display) {
$viewpath = $display->display_options['path'];
// if arguments have been passed to the view, include these
if ($view->args) {
$viewpath .= '/'. join('/', $view->args);
}
$viewpage = $viewpage || ($viewpath == $curpath);
}
if ($viewpage) {
$tags = nodewords_get('views', array($view->vid));
foreach ($tags as $name => $content) {
if (!empty($content)) {
drupal_set_html_head('<meta name="'. $name .'" content="'. $content .'" />');
}
}
}
}
?>
patch attached:
#5
#6
Damn project.module didn't same my text, tag alterations!!... ^^^ Updated patch for a much more solid views support. Fixes some slopy regex in my previous patch, and works for all kinds of views.
#7
The proposed patch contains a call to a third-party module private function (
_custom_breadcrumbs_paths_page_match()); Meta tags cannot rely on the presence of a third-party module, not depend from it.It's then a private function, and we should avoid to call it.
#8
I looked at the code of that function, and created a similar function in the project code.
The changes have been committed in CVS.
Thanks for your help.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.
#10
There are no metatags on pages generated with views, on front page, on no-node pages.
#11
This is an old issue. As the code is completely different from the one developed one year ago, it is better to open a different issue.