|
Re:SEO for fireboard still not answered 3 Months ago
|
|
I came up with:
(it also skips keywords shorter than 3 characters by the way)
| Code: |
if (!$fmessage->parent) {
$mosConfig_MetaKeys = '';
$pattern = array('/[b](.*?)[/b]/is','/[i](.*?)[/i]/is','/[u](.*?)[/u]/is','/[img(.*?)[/img]/is','/[url](.*?)[/url]/is','/[url=(.*?)](.*?)[/url]/is');
$replace = array('$1','$1','$1',' ','$1','$2');
$metapost = preg_replace($pattern, $replace, substr($fmessage->message,0,400));
$metapost = preg_replace('/[^a-z .A-Z0-9s]/',' ', $metapost);
$metasubj = preg_replace("/[^a-z .A-Z0-9s]/", " ", $fmessage->subject);
$metadesc = $metasubj . ' - ' . $metapost;
$mainframe->addMetaTag( 'description' , $metadesc );
$keyarray = explode (' ' , $metasubj . ' ' . $metapost);
$search_ignore = array();
@include "$mosConfig_absolute_path/language/$mosConfig_lang.ignore.php";
foreach ($keyarray as $keytest)
{
$keytest = str_replace('.' , '', strtolower(trim($keytest)));
if ($keytest && !in_array( $keytest, $search_ignore ) && strlen($keytest)>3)$metakey .= $keytest . ', ';
}
if ($metakey) $mainframe->addMetaTag( 'keywords' , substr ($metakey, 0, -2));
}
|
(why can't fireboard keep it's hands of text labeled as code?) 
|
|
rickert (User)
Junior Boarder
Posts: 26
|
Logged
|
|
|
Last Edit: 2008/07/08 14:30 By rickert.
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 3 Months ago
|
|
|
Who has the latest version of this? I would like to add this into the 1.0.5 release if possible.
Thx!
|
|
|
Logged
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 3 Months ago
|
|
Hi fxstein, so we meet on another SEO thread.
Well as long as nobody thinks of something better I vote for the code in my last post.
Actually there two pieces of code. One for generating the title of the post and one for generating the meta keywords and description.
The piece for the title:
| Code: |
if ($fmessage->parent == 0) {
$mainframe->setPageTitleAlias($fmessage->subject. ' - ' . $GLOBALS['mosConfig_sitename']);
}
|
Rickert
By the way: while replying, the code I posted before looks a lot better.
|
|
rickert (User)
Junior Boarder
Posts: 26
|
Logged
|
|
|
Last Edit: 2008/07/08 23:24 By rickert.
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 3 Months ago
|
|
|
@rickert
What file do you suggest to mod with this?
Thx a lot for your help!
|
|
|
Logged
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 3 Months ago
|
|
you should mod view.php
the code for generating meta keywords and description should be inserted after
| Code: |
if ($badwords == "true") {..}
|
the code for changing the title should be inserted after
| Code: |
//set page title if on Mambo 4.5.2+
|
in stead of
| Code: |
if ($leaf->parent == 0) {..}
|
|
|
rickert (User)
Junior Boarder
Posts: 26
|
Logged
|
|
|
Last Edit: 2008/07/09 02:52 By rickert.
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 2 Months, 3 Weeks ago
|
|
I think i have a work around for this, if anyone is still interested. It only creates a custom description metatag for individual threads. It doesn't help category or topic pages.
edit the view.php script in the template that you are using.
on or about line 522 you will see the following code
| Code: |
$mainframe->setPageTitle($fmessage->subject . ' - ' . $fbConfig['board_title']);
|
right after that insert the following code:
| Code: |
$ContentDescription = $fmessage->subject." - " . substr(strip_tags($fmessage->message),0,100);
$ContentKeywords = $fmessage->subject;
|
then on or about line 1308 of the same file you will see:
| Code: |
$msg_personal,
$myGraph);
$useGraph = 0;
} // end for
|
after that add:
| Code: |
$mainframe->appendMetaTag( 'description',$fbConfig['board_title']." - ".$ContentDescription);
$mainframe->appendMetaTag( 'keywords',$ContentKeywords );
|
Let me know if this works.
|
|
jakus1 (User)
Fresh Boarder
Posts: 3
|
Logged
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 2 Months, 3 Weeks ago
|
|
|
Thx for sharing. I wonder if we should combine these two solutions. I like the keyword parsing and limiting it to a minimum of 3 characters.
Comments?
|
|
|
Logged
|
|
|
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 2 Months, 3 Weeks ago
|
|
how about this:
| Code: |
//set page title if on Mambo 4.5.2+
// if view = flat and first message on page OR if view = threaded
if (($view == "flat" && floor($mmm-1/$limit) == ($mmm-1)/$limit) || $view == "threaded")
{
// BUILD PAGETITLE
// Filter Re: from the subject of the first message on the page
$metasubj = str_replace("Re:","",$fmessage->subject);
//Set pagetitle with subject followed by sitename
$mainframe->setPageTitleAlias($metasubj. ' - ' . $GLOBALS['mosConfig_sitename']);
// BUILD DESCRIPTION METATAG
//Strip bbcode, newlines and returns from messagetext
$pattern = array('/[b](.*?)[/b]/is','/[i](.*?)[/i]/is','/[u](.*?)[/u]/is','/[img(.*?)[/img]/is','/[url](.*?)[/url]/is','/[url=(.*?)](.*?)[/url]/is','/[nr]/');
$replace = array('$1','$1','$1',' ','$1','$2',' ');
$metapost = preg_replace($pattern, $replace, substr($fmessage->message,0,400));
// Set description to stripped subject and messagetext
$mainframe->addMetaTag( 'description' , $metasubj . ' - ' . $metapost);
//BUILD KEYWORDS METATAG
//initialize metakeys
$mosConfig_MetaKeys = '';
// Strip any character from subject and messagetext except a-z, A-Z and 0-9
$metapost = preg_replace('/[^a-z .A-Z0-9s]/',' ', $metapost);
$metasubj = preg_replace('/[^a-z .A-Z0-9s]/',' ', $metasubj);
//Build array with suggested keywords and build array with keywords to be ignored
$keyarray = explode (' ' , $metasubj . ' ' . $metapost);
$search_ignore = array();
@include "$mosConfig_absolute_path/language/$mosConfig_lang.ignore.php";
foreach ($keyarray as $keytest)
{
$keytest = str_replace('.' , '', strtolower(trim($keytest)));
// Add to keywords metatag if length > 3 AND not to be ignored
if ($keytest && strlen($keytest)>3 && !in_array( $keytest, $search_ignore ))
$metakey .= $keytest . ', ';
}
if ($metakey)
$mainframe->addMetaTag( 'keywords' , substr ($metakey, 0, -2));
}
|
By the way:
The setPageTitleAlias function is a function I created earlier on for my Joomla content
It simply sets the pagetitle to the string that is passed (in stead of adding the sitename in front like setpagetitle does). I copied and modified setpagetitle (from joomla.php). Maybe you should solve this in another way.
| Code: |
// setPagetitleAlias - function sets the title of the
// page to tile_alias
function setPagetitleAlias( $title_alias=null ) {
if (@$GLOBALS['mosConfig_pagetitles']) {
$title_alias = trim( htmlspecialchars( $title_alias ) );
$title_alias = stripslashes($title_alias);
$this->_head['title'] = $title_alias;
}
}
|
|
|
rickert (User)
Junior Boarder
Posts: 26
|
Logged
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 2 Months, 3 Weeks ago
|
|
|
Both of the other solutions are infinitely more elegant than the one I posted and i use the on posted two posts above mine with the following exception. I don't set the description until the code exits the loop. That way i control the length and i make it from the text of the "latest" post.
|
|
jakus1 (User)
Fresh Boarder
Posts: 3
|
Logged
|
|
|
The administrator has disabled public write access.
|
|
|
Re:SEO for fireboard still not answered 2 Months, 2 Weeks ago
|
|
I`ll like to see these seo hacks in FB 1.0.5 final.
BUT this code must be modified to avoid double meta description  , and other doube meta
|
|
|
Logged
|
|
|
Last Edit: 2008/07/29 18:06 By kingBT.
|
|
|
The best things are the things for free
|
|
|
The administrator has disabled public write access.
|
|
|