DedeCMS一个SEO优化重要标签likearticle,根据标题、关键字调用本栏目下的相似文章。这意味着为某文章增加了许多带“长尾关键词”的文章,内容相关度增强,为网站增加PV。缺点是不能调用全站相似文章,不支持order by排序属性,做如下修改:
likearticle全站调用相似文章
打开/include/taglib/likearticle.lib.php,找到
$typeid = " And arc.typeid in($typeid) And arc.id<>$arcid ";
修改为
$typeid = " And arc.id<>$arcid ";
likearticle支持order by排序
继续找到
extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ";
下面添加
$orderby=$ctag->GetAtt('orderby');
找到
if( empty($arcid) || $byabs==0 ) { $orderquery = " order by arc.id desc "; } else { $orderquery = " order by ABS(arc.id – ".$arcid.") "; }
修改为
$orderquery = "; if($orderby=='hot' || $orderby=='click') $orderquery = " order by arc.click $orderWay"; else if($orderby == 'sortrank' || $orderby=='pubdate') $orderquery = " order by arc.sortrank $orderWay"; else if($orderby == 'id') $orderquery = " order by arc.id $orderWay"; else if($orderby == 'near') $orderquery = " order by ABS(arc.id – ".$arcid.")"; else if($orderby == 'lastpost') $orderquery = " order by arc.lastpost $orderWay"; else if($orderby == 'scores') $orderquery = " order by arc.scores $orderWay"; else if($orderby == 'rand') $orderquery = " order by rand()"; else if($orderby == 'weight') $orderquery = " order by arc.weight asc";//如果没有特定设置排序则按照权重先排序 else $orderquery = " order by arc.sortrank $orderWay";
发表评论
评论列表(条)