By dmez on
This is if you want your meta keyword (and description) always change in every page
i use it on my site FreewareList.net
1. create php fle with name keyword.php
<?php
//to find the number of words so as to prevent the repetition of keywords
$delim = " ";
$string = "$head_title";
$words = count(explode($delim, $string));
//splits the title in to pieces
$pieces = explode(" ", $head_title);
for ( $counter = 0; $counter < $words; $counter += 1) {
// piece1 and comma
$badw=badwords("$pieces[$counter]");
echo $badw;echo ",";
}
?>
2. create php file with name filter.php
it's up to you ti select wich word that you want to block
for my site , i create like this:
<?
function badwords($string)
{
$replace = array();
$with = array();
$replace[] = "|";
$with[] = "files";
$replace[] = "and";
$with[] = "software";
$replace[] = "&";
$with[] = "games";
$replace[] = "Beta";
$with[] = "full";
$replace[] = "RC";
$with[] = "ready";
$replace[] = "Alpha";
$with[] = "full";
$replace[] = "List";
$with[] = "programs";
$replace[] = "Freeware";
$with[] = "freeware";
$replace[] = "Fresh";
$with[] = "microsoft";
$replace[] = "-";
$with[] = "utilities";
$replace[] = "Update";
$with[] = "update";
$replace[] = "Daily";
$with[] = "daily";
$replace[] = "Collection";
$with[] = "multimedia";
/* just keep adding em */
return str_replace($replace, $with, $string);
}
?>
3. upload it into drupal script root
and include it into your header (page.tpl.php)
for my site i create like this:
<title>Download <?php print $head_title ?></title>
<meta name="description" content="Download <?php print $head_title ?>">
<meta name="keywords" content="download,<?php include("filter.php"); ?><?php include("keyword.php"); ?>windows, desktop, icons, cursors, screen savers, desktop themes, fonts, education, games, graphics, finance, internet">
to see the result, just chek my site FreewareList.net
meta meyword and description always change in every page
google indexing:
Click here
(it's 4 month age site)
that's it
i hope it's working for your site too
Comments
Have also a look at
http://drupal.org/project/nodewords , it's worth.
Thomas Narres
Keep the sunny side up
Thomas Narres
Keep the sunny side up
i don't see how the
i don't see how the nodewords is better then this. Can you count on your users to actually write tags, they don't care about that.
Thanks for this script.