DedeCMS标签likearticle调用全站相关文章支持排序

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";  

给TA打赏
共{{data.count}}人
人已打赏
网站教程

织梦系统如何增加字体

2019-12-26 8:00:00

网站教程

帝国备份王5.1正式版,备份数据库神器

2019-12-28 8:00:00

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索