Hi,
I'm having problems with meta tag DESCRIPTION, it never shows on my pages even when I have set to use the node teaser if there is no description set on a node.
If I downgrade to Nodewords 1.0 the tags are displayed correctly (they are taken form the node teaser), the problem appears when I upgrade to Nodewords 1.11.
I don't know if I am missing something on the module configuration or if this is a bug on the current version.
Thanks in advance,

Julio

Comments

avpaderno’s picture

Component: User interface » Code
Status: Active » Fixed

The code has been fixed; there were some issues that didn't allow to correctly handle that meta tag.

jdangelo’s picture

I know that it's fixed, but why 1.11 does not show description tag on my site and 1.0 does ?
Which is the correct module config to make it work ?, probably I am missing something.

Regards,

Julio

avpaderno’s picture

You are not missing anything; code in version 6.x-1.11 is bugged, and it doesn't work as it should.
The code has been fixed, but version 6.x-1.11 cannot be fixed because in Drupal releases cannot be changed, after they are released.

jdangelo’s picture

Category: support » bug
Status: Fixed » Active

Comparing description.inc from version 1.0 Vs nodewords.module from version 1.11, I found the problem.

In description.inc the code used to get the content of a node teaser is the following:

function nodewords_description_prepare($type, $ids, $value, $settings) {
  if ((!isset($value) || empty($value)) && $settings['use_teaser'] && count($ids) == 1) {
    switch ($type) {
      case 'node':
        $node = node_load($ids[0]);
        if ($node && node_access('view', $node)) {
          // HACK: see http://drupal.org/node/79315 (can't use php functions in
          // body of nodes). Note that this still won't work if you have a
          // CCK field with PHP format.
          if (filter_format_allowcache($node->format)) {
            // We would like to use node_view($node, TRUE, FALSE), unfortunately
            // this uses theme_node() which, by default, adds 'Posted by ...'
            // information (which we don't want). The code below calls all
            // functions node_view() does, without the theme.
            $node = node_build_content($node, TRUE, FALSE);
            $content = drupal_render($node->content);
            $node->teaser = $content;
            node_invoke_nodeapi($node, 'alter', TRUE, FALSE);
            $value = $node->teaser;
          }
        }
        break;
...

While in nodewords.module that code is in the function "nodewords_metatag_from_node_content" and in the function "nodewords_basic_description_prepare" from nodewords_basic.module.
Here the way to use $node->body and $node->teaser is different and apparently it does not work in every case (different types of nodes).

nodewords.module, line 1011

    ...
      $text = strip_tags(
        preg_replace_callback('/<img\s[^>]*alt=["\']([^"\']*)["\'][^>]*>/i',
          '_nodewords_match_callback',
          $node->teaser
        )
      );
    ...

and nodewords.module, line 1063

    ...
    $text = strip_tags(
      preg_replace_callback('/<img\s[^>]*alt=["\']([^"\']*)["\'][^>]*>/i',
        '_nodewords_match_callback',
        $node->body
      )
    );
    ...

using the code from "nodewords_description_prepare" funtion to get the values for $node->body and $node->teaser solves the problem.
Hope this helps,

Regards,

Julio

avpaderno’s picture

Versions 6.x-1.0, and 6.x-1.11 have features, and finding any differences in their code doesn't mean the latest version has a bug.
Then, I have already said there are bugs in version 6.x-1.11 which have been already fixed; read comment #3.

jdangelo’s picture

First of all I was not trying to find differences between codes of different versions. I have a problem with the current version of nodewords, and as I explain earlier, most of my website pages are not displaying the metatag description and this is an issue that I need to solve.
And you are right, finding a difference between codes does not means that the version has a bug. But as I explain the feature "Generate meta tags content from the node teaser" is not working in all cases. What I'm doing here is describing an issue in the current version (not all the teasers al displayed in description metatag) and pointing out a part of the old code that solves the problem.
I'm not an expert in Drupal code, I am just reporting a problem and a possible solution to the nodewords module maintainers.
Please let know if the feature "Generate meta tags content from the node teaser" of current version 1.11 will work for all node types as it was working in version 1.0.

Thanks in advance.

avpaderno’s picture

Status: Active » Postponed (maintainer needs more info)

Generation of meta tag content from node teaser works, for me with the latest developed code.

Considering that the new version has more settings, are you sure you checked them?

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="canonical" href="http://sunradio.local/dr61/la/node/23367" />
<meta name="description" content="Node teaser." />
<meta name="revisit-after" content="1 day" />
<link rel="shortcut icon" href="/dr61/misc/favicon.ico" type="image/x-icon" />
avpaderno’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

I am marking this report as duplicate of #673624: Node meta tag description does not correctly work.

Michsk’s picture

I have the latest 6.1.1 dev but no descriptons nore keywords are shown.