The 'Use the teaser of the page if the meta description is not set?' functionality does not seem to be compatible with CCK....

might this be a problem correlated to CCK not featuring proper default teasers?

I also tryed defining teasers for my CCK types with phptemplate files (node-content_type.tpl.php) and with the Contemplate module, but still they are not recognized by Nodewords...

any chance to see this work?

Thank you very much!

Comments

toma’s picture

I have the same problem here, so my all site get ignore some pages in the search engine, any solution for that

Thank you

Robrecht Jacques’s picture

nodewords doesn't use the theming template, it uses $node->body. Unfortunately, CCK doesn't seem to populate $node->body as it should. I'll look into this more closely next week.

toma’s picture

thank you so much for that, its really important the key words module, its a good idea to added in drupal core

Thanks

marcoBauli’s picture

Thank you Robrecht, seems that description is more relevant than keywords in SEO, so this is very desirable functionality!

+1 tester :)

scb’s picture

CCK doesn't populate body nor teaser fields. You may do that manually, using this piece of code proposed by Duke:
http://drupal.org/node/69981#comment-160952
This should make it work, I think.

toma’s picture

Thanks sergiocaridad, but i don't really get that solution to work, can someone try to explain what we can do ! make a new module for each content type, i don't understand really

Robrecht Jacques’s picture

It's a solution that can be used in nodewords. Strange that CCK doesn't do it by default. I will try to implement it inside nodewords.module next wednesday.

Robrecht Jacques’s picture

I have fixed the bug that made nodewords use an empty DESCRIPTION for CCK nodes (as a side effect of fixing http://drupal.org/node/89067) and have put instructions in README.txt to advise users to use contemplate module to adapt the auto-generated content.

Please check if this solution (nodewords.module version 1.32.2.13) solves your concerns.

Caleb G2’s picture

I've got the contemplate module and the most recent nodewords module (version 1.32.2.13) active, but I cannot get an automatic description to show up for me (it will if I manually enter one).

Can someone expand on these instructions in the README.txt a bit:

"It is recommended to use the contemplate (Content Template) module to
create a nicer looking node teaser that can also be used as auto-generated
DESCRIPTION."

What do I need to add to the teaser in contemplate to get nodewords to automatically generate a description?

Robrecht Jacques’s picture

Can someone expand on these instructions in the README.txt a bit:

It is recommended to use the contemplate (Content Template) module to create a nicer looking node teaser that can also be used as auto-generated DESCRIPTION.

What do I need to add to the teaser in contemplate to get nodewords to automatically generate a description?

Suppose you create a CCK node with a title, a body and a color field. The default teaser for this will be:

body

Some placeholder text.

color

red

Now nodewords strips all markup for the meta description tag and will thus have bodySome placeholder text. colorred as meta description, which is probably not what one wants.

If you go to administer >> content >> templates (which appears if you install the contemplate module), you can create a template for this cck type. For example you could set the teaser template to:

<?php print $field_body[0]['view'] ?>
<p>I am <?php print $field_color[0]['view'] ?>.</p>

For the same node above this will create following teaser:

Some placeholder text.

I am red.

And the autogenerated meta description will become Some placeholder text. I am red.

So by modifying the teaser template with contemplate, you can change the auto-generated meta-description.

Is this helpful?

Caleb G2’s picture

Hm. I guess my situation is similar to but not exactly like the CCK situation then. What I've done is use contemplate along with the standard Drupal "blog" node-type and the excerpt module to create separate teaser and body text input areas so that my users don't have to worry about using the break command anymore.

So in contemplate right now what I have for the teaser is:

<?php print $teaser; ?>

and what is contemplate's body field is:

<?php print check_markup($teaser); ?><?php print $body; ?><p></p>

Is there something easy I can tack onto those areas to get the auto description working?

marcoBauli’s picture

robrecht: tested the new version and creates beautyfull meta descriptions as promised (it also trims the text lenght to 255 chars, wow!) Thank you so much man :D !

caleb: sorry, not sure what are you really meaning here..For CCK, print $body and print $teaser are not good choices, but don't know about blog+excerpt. Basically Contemplate works with any sort of node type, the only thing is to pick the right variables (you should see a list of the exposed ones in the fields on the right in the template settings page, but you can use or expose more than these with some trickery/hack in the modules. Have a look in the issue queue of Contemplate, there are a couple of posts talking more about this).

Caleb G2’s picture

This probably only useful for me since I'm running a fairly atypical setup, but I figured out how to get the auto description working by just changing this line in the nodewords.module $tags['description'] = $node->teaser; to $tags['description'] = $node->body;.

This is because the way I have things set up all the info for the node gets put in the body field/database table and the teaser is actually just generated citrually from the body. Bottomline it works. :)

Caleb G2’s picture

Sorry to be a pain...but I've got a strange situation whereby two separate sites, which seem to be identical in all the ways that should matter, won't both display auto description using the hack I made above (though the site that is not autogenerating does display it if I manually type in the description). I tried to isolate the problem/difference for hours, but I just can't see what is dis-similar between them (tried dragging templates back and forth, disabling modules, run file diff's, taking the hack out, etc.)

So the question is - is there a way to put a statement in the head section of page.tpl.php which would force the auto generation of a description?

I've tried putting this in the head section of page.tpl.php without success:
<?php $tags['description'] = $node->teaser; ?>
and...
<?php $tags['description'] = $node->body; ?>

Any suggestions?

Robrecht Jacques’s picture

Status: Active » Fixed

Caleb G, please contact me personally either by email (use my contact form) or on IRC (#drupal-support) to solve your specific problem.

Nodewords never uses $node->body, it only uses $node->teaser. Probably that's your problem.

Setting it as fixed (as the original issue was fixed).

Anonymous’s picture

Status: Fixed » Closed (fixed)