
08-10-2007, 06:54 PM
|
|
Clueless
|
|
Join Date: Jul 2007
Posts: 28
|
|
limiting keywords, title and description
The point is to make the page seo friendly.
I did this in include/myfunctions.ini.php
underneath where it says I changed the code to this:
Code:
$titlelength = strlen($page['title']); // count number of characters
$titlelimit = 77; // set character limit
if ($titlelength > $titlelimit) { // if character number if more than character limit
$page['title'] = substr($page['title'],0,$titlelimit) . "..."; // display string up to character limit, add dots
}
print '<title>'.$page['title'].'</title>';
if($page['keywords'] != ''){
$keywordlength = strlen($page['keywords']); // count number of characters
$keywordlimit = 150; // set character limit
if ($keywordlength > $keywordlimit) { // if character number if more than character limit
$page['keywords'] = substr($page['keywords'],0,$keywordlimit); // display string up to character limit, add dots
}
print '<meta name="keywords" content="'.$page['keywords'].'">';}
else
print '<meta name="keywords" content="'.$page['title'].'">';
$descriptionlength = strlen($page['description']); // count number of characters
$descriptionlimit = 147; // set character limit
if ($descriptionlength > $descriptionlimit) { // if character number if more than character limit
$page['description'] = substr($page['description'],0,$descriptionlimit) . "..."; // display string up to character limit, add dots
}
print '<meta name="description" content="'.$page['description'].'">';
}//end function
limiting the title to 80 chars, and the meta keywords and description to 150.
edit:
some other nice things to do are, make the titles link to the websites instead of having 'visit site' as the link text. I put thumbshots previews under the descriptions too and it looks really nice. My site is links.eyewearcases.com if you want to see. /plug
Last edited by eyewearcases : 08-10-2007 at 07:12 PM.
|