phpLD mod : context sensitive RSS
juust | 21/08/2008(in case you’re wondering : this is about a small rss plugin for a php link directory site I am setting up, see example : links.trismegistos.net/blogs/).
I tried some free RSS mod but that dont work, I get the same yahoo rss feed on every page. I want context sensitive rss.
Why ? to improve my keyword/content ratio per page and get more pages indexed. I hear 2-5% (1 in 50/20 words) is the ideal ratio if you want to be considered a highly relevant result page on the keyword-content ratio. A list with website links in the category ‘music – classic’ has a very high ratio keyword/content and google won’t index the page. Adding a pot-luck grab of google blogsearch results might level that a little.
So I am gonna add some relevant fresh rss feeds from google blogsearch.
Same trick as the pagerank plug-in, the last part of the url contains the subcategory, I can use these as keywords for google blogsearch :
-
$PT = $_SERVER["REQUEST_URI"];
-
$ttl = explode('/', $PT);
-
$mykeys = $ttl[count($ttl)-2];
-
$mykey=trim(preg_replace('/_/', ' ', $mykeys));
-
$xmlSource="http://blogsearch.google.com/blogsearch_feeds?hl=en&c2coff=1&lr=&safe=active&as_drrb=q&as_qdr=d&q=".urlencode($mykey)."&ie=utf-8&num=5&output=rss";
- I take the URI
- explode it on the / slashes
- take the last text
- replace ‘_’ with spaces
- and urlencode the keywords for google blog-search.
A generic rss parser handles the xml file, i delimit it to 5 results to keep traffic down. I add some class markers in the script to be able to add extra markup in a .css file, and I save the result to $thisfeed.
-
foreach($result as $arr){
-
$strResult .= '<div class="rssdiv">';
-
$strResult .= '<div class="rss_title"><h3>'.$arr["title"].'</h3></div>';
-
$strResult .= '<div class="rss_description">'.$arr["description"].'</div><br />';
-
-
$strResult .= '<div class="rss_link"><a href="'.$arr["link"].'" rel="nofollow" title="'.$arr["title"].'">more: "'.$arr["title"].'"</a></div>';
-
$strResult .= '</div>';
-
}
-
-
$tpl->assign('thisfeed', $strResult);
I call the store feed in the footer with {$thisfeed}
and include the sourcefile in index.php with
require_once ‘readrss.php’;
just below require_once ‘init.php’;
See example : links.trismegistos.net/blogs/
Now I am going to add a single google adsense slot, not too loud, just enough to get Google to come crawl the pages to assert the context. Then I need to resubmit the sitemap. And that’ll be all for today.
(readrss.php text source)
for the record, consider it GPL’ed (it ain’t exactly rocket science)








