Keyword

Smarter meta keywords

  • Robert Broughton
  • Robert Broughton's Avatar Topic Author
  • Offline
  • New Member
More
14 years 8 months ago #81240 by Robert Broughton
Smarter meta keywords was created by Robert Broughton
I just added a piece of code to views/item/view.html.php.After these three lines:        if ($item->metakey) {            $document->setMetadata('keywords', $item->metakey);        }I added these 11 lines:        else if (isset($item->tags) && count($item->tags))        {            $tags_string = "";            foreach ($item->tags as $this_tag)            {               if (strlen($tags_string))                   $tags_string .= ", ";               $tags_string .= $this_tag->name;                }            $document->setMetadata('keywords', $tags_string);        }What this accomplishes is, if you don't define any keywords for an article, the article tags become meta keywords instead.

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago #81241 by FidelGonzales
Replied by FidelGonzales on topic Smarter meta keywords
To confirm, this code simply adds article tags to meta keywords when none are manually inserted into the article, right?

If so, that's a great idea. I hate having to manually add meta to everything I had just typed into the tags field.

Please Log in or Create an account to join the conversation.

  • Robert Broughton
  • Robert Broughton's Avatar Topic Author
  • Offline
  • New Member
More
14 years 7 months ago #81242 by Robert Broughton
Replied by Robert Broughton on topic Smarter meta keywords
FidelGonzales said:To confirm, this code simply adds article tags to meta keywords when none are manually inserted into the article, right?


That's correct.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum