logo       

phpWebsite, SEO, and Meta Tags: msg#00033

Subject: phpWebsite, SEO, and Meta Tags
Over the past couple of months, I have noticed search engines crawling
the site and concentrating on the calendar.  Each search engine crawls
each calendar entry (year / month /day) regardless of whether or not
there is content.  This uses up a considerable amount of bandwidth which
I would like to conserve.

Currently, I have two solutions available...  To disallow search engine
bots access to the calendar via the robots.txt file, or to set the robot
meta tag to either "noindex, nofollow" or "index, nofollow."  I want
calendar events crawled, but I want them restricted so disallowing via
robots.txt or the robot meta tag of "noindex, nofollow" are not viable
solutions.  The problem with "index, nofollow" is that search engines
will not crawl other appropriate pages from links on a page the search
engine robot does crawl.

The solution I believe is appropriate is to have the meta tag variables
global which can be set by the module (as needed / desired).  This can
be accomplished ala the addPageTitle function in Layout.php.  Following
is a patch of Layout.php (for phpWebsite v0.10.1) which will enable
modules to set meta tags (with the exception of generator and
content-type).  The added functions are:
        setKeywordsTag
        setDescriptionTag
        setRobotTag
        setAuthorTag
        setOwnerTag

Of course, to implement the changes in a module, a field (column) would
have to be created in the mod's db for each metatag which would be
changed in the module or hard-coded in.

I will work on a calendar-specific hack over the next few days.

One of the reasons I worked on this was to 1) see how easy / difficult
it would be to implement in the current version of phpWebsite and 2) to
bring attention to the issue before the release of phpWebsite v1.0.

As always, any and all comments are welcomed.  I am not the world's most
proficient coder, so if anyone sees an easier solution, please let me
know.

Ken Nordquist

*****  start patch  *****
--- Layout.php.old      2005-05-15 20:43:09.000000000 -0400
+++ Layout.php  2005-05-16 07:36:19.000000000 -0400
@@ -10,6 +10,7 @@
  * Controls the layout and themes
  *
  * @version $Id: Layout.php,v 1.72 2005/03/07 14:05:42 steven Exp $
+ * changed to allow meta tag(s) to be changed per module (172-2 patch)
  * @author Matthew McNaney <matt@xxxxxxxxxxxxxxxxxxxxxxx>
  * @package phpWebSite
  */
@@ -498,17 +499,56 @@
     }
   }
 
+  function setKeywordsTag($keywords_tag) {
+    $title = strip_tags($keywords_tag);
+    $GLOBALS['keywords_tag'] = $keywords_tag;
+  }
+
+  function setDescriptionTag($description_tag) {
+    $title = strip_tags($description_tag);
+    $GLOBALS['description_tag'] = $description_tag;
+  }
+
+  function setRobotTag($robot_tag) {
+    $title = strip_tags($robot_tag);
+    $GLOBALS['robot_tag'] = $robot_tag;
+  }
+
+  function setAuthorTag($author_tag) {
+    $title = strip_tags($author_tag);
+    $GLOBALS['author_tag'] = $author_tag;
+  }
+
+  function setOwnerTag($owner_tag) {
+    $title = strip_tags($owner_tag);
+    $GLOBALS['owner_tag'] = $owner_tag;
+  }
+
+
   function getMetaTags(){
     $metatags = '<meta name="generator" content="phpWebSite" />
 ';
 
+    if (isset($GLOBALS['keywords_tag'])) {
+               $metatags .= '<meta name="keywords" 
content="'.$GLOBALS["keywords_tag"].'" />
+';
+    } else {
+
     if ($this->meta_keywords)
       $metatags .= '<meta name="keywords" content="'.$this->meta_keywords.'" />
 ';
+}
+
+
+    if (isset($GLOBALS['description_tag'])) {
+      $metatags .= '<meta name="description" 
content="'.$GLOBALS["description_tag"].'" />
+';
+    } else {
 
     if ($this->meta_description)
       $metatags .= '<meta name="description" 
content="'.$this->meta_description.'" />
 ';
+}
 
     if (isset($GLOBALS['block_robot'])) {
       $robot = '00';
@@ -516,6 +556,29 @@
       $robot = &$this->meta_robots;
     }
 
+    if (isset($GLOBALS['robot_tag'])) {
+      switch ($GLOBALS['robot_tag']){
+      case '00':
+       $metatags .= '<meta name="robots" content="noindex, nofollow" />
+';
+       break;
+
+      case '01':
+       $metatags .= '<meta name="robots" content="noindex, follow" />
+';
+       break;
+
+      case '10':
+       $metatags .= '<meta name="robots" content="index, nofollow" />
+';
+       break;
+
+      case '11':
+       $metatags .= '<meta name="robots" content="index, follow" />
+';
+       break;
+      }
+    } else {
 
     if ($this->meta_robots){
       switch ($robot){
@@ -540,19 +603,38 @@
        break;
       }
     }
+       }
+
+    if (isset($GLOBALS['author_tag'])) {
+      $metatags .= '<meta name="author" content="'.$GLOBALS["author_tag"].'" />
+';
+    } else {
 
     if ($this->meta_author)
       $metatags .= '<meta name="author" content="'.$this->meta_author.'" />
 ';
+}
 
-    if ($this->meta_owner)
-      $metatags .= '<meta name="owner" content="'.$this->meta_owner.'" />
+    if (isset($GLOBALS['owner_tag'])) {
+               $metatags .= '<meta name="owner" 
content="'.$GLOBALS["owner_tag"].'" />
+';
+    } else {
+               if ($this->meta_owner)
+                       $metatags .= '<meta name="owner" 
content="'.$this->meta_owner.'" />
 ';
+       }
 
     if ($this->meta_content)
       $metatags .= '<meta http-equiv="content-type" content="text/html; 
charset=' . $this->meta_content.'" />
 ';
 
+       // set meta tag globals to "null" so they do not affect other pages
+       $GLOBALS["keywords_tag"] = '';
+       $GLOBALS['description_tag'] = '';
+       $GLOBALS['robot_tag'] = '';
+       $GLOBALS['author_tag'] = '';
+       $GLOBALS['owner_tag'] = '';
+
     return $metatags;
   }

*****  end patch  *****



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe