QQ 1640076782

2010年04月30日

osCommerce开源 -独特的文本搜索引擎优化

Filed under: 网站程序OSC — past @ 1:06 下午

osCommerce外贸建网开源码二次开发 -独特的文本搜索引擎优化

如果你有一个产品级属于多个目录类别, 那么谷歌将会惩罚你网站上出现的重复内容。但这一惩罚是可以避免的,下面我们就要介绍如何避免google 的这一惩罚:

这简单的3步骤,将你的产品描述动态的插入随机的无形的HTML字符,除了重要的关键字

1.运行后台配置管理内容:

INSERT INTO configuration (`configuration_title`,`configuration_key`,`configuration_value`,`configuration_description`,`configuration_group_id`,`sort_order`,`last_modified`,`date_added`) VALUES (‘SEO Unique Text – Words to Exclude’, ‘SEO_UNIQUE_TEXT_IGNORE’, ”, ‘List all of the words that you don\’t want modified separated by a semi-colon.’, ’1′, ’999′, NOW(), NOW());

2  .添加新函数:

function tep_unique_text($text, $exclude_addtl = ”) {

if (trim($text) == ”) return $text;

$excluded_words = array();

if (SEO_UNIQUE_TEXT_IGNORE != ”) {
$excluded_words = explode(‘;’, SEO_UNIQUE_TEXT_IGNORE);

if (is_array($exclude_addtl) && count($exclude_addtl) > 0) {
$excluded_words = array_merge($excluded_words, $exclude_addtl);
}

$identifier = 0;

if (count($excluded_words) > 0) {
foreach ($excluded_words as $exclude) {
$text = str_replace(trim($exclude), ‘{<{‘ . $identifier . ‘}>}’, $text);
$identifier++;
}
}

}

$letters = array(“abc”,”def”,”ghi”,”jkl”,”mno”,”mno”,”pqr”,”stu”,”vwx”,”yz”);

for ($x = 0; $x < count($letters); $x++) {
srand((float) microtime() * 10000000);

$the_letter = rand(0,2);

$text = str_replace($letters[$x][$the_letter], $letters[$x][$the_letter] . “­”, $text);

$text = str_replace(strtoupper($letters[$x][$the_letter]), strtoupper($letters[$x][$the_letter]) . “­”, $text);
}

if (SEO_UNIQUE_TEXT_IGNORE != ”) {
$identifier = 0;

if (count($excluded_words) > 0) {
foreach ($excluded_words as $exclude) {
$text = str_replace(‘{<{‘ . $identifier . ‘}>}’, trim($exclude), $text);
$identifier++;
}
}
}

preg_match_all(‘/<(.[^>]*)>/’, $text, $matches);

foreach ($matches as $match) {
$clean = str_replace(‘­’, ”, $match);

$text = str_replace($match, $clean, $text);
}

return $text;
}

3 . 产品详细页,找出产品描述输出的位置

原:<p><?php echo stripslashes($product_info['products_description']); ?></p>

替换为:

<p>
<?php
/* This array should contain variables that hold phrases that should not be changed */
$excluded_words = array($product_info['products_name']);
echo stripslashes(tep_unique_text($product_info['products_description'], $excluded_words));
?>
</p>

完成。osCommerce独特的文本SEO