Bigcommerce产品分类:给重复的CategoryName链接添加rel="nofllow"标记

公司系统里产品分类名称,有多个重复的“Others”和“Recommended”,所以要给相同名字的分类a链接加上rel="nofllow",这样有利于SEO~

Bigcommerce有俩种样式的Category列表展示。一种是普通模式的树形列表模式,一种是弹出式透明背景的模式,以下分别讲讲这俩种:如何给重复的CategoryName链接添加rel="nofllow"标记

第一种:普通模式的树形列表模式

1.在模板目录的/Snippets有个SideCategoryList.html,复制一份重命名为SideCategoryList_Rel.html

把里面的内容修改为:

<li class="%%GLOBAL_LastChildClass%%">
    <a href="%%GLOBAL_CategoryLink%%" rel="nofollow">%%GLOBAL_CategoryName%%</a>
    %%GLOBAL_SubCategoryList%%
</li>


2.修改include/display/SideCategoryList.php文件

找到第57行:$output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCategoryList");

改为:

if($catName=='Others' or $catName=='Recommended')

{
     $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCategoryList_Rel");
 }else{                    
     $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("SideCategoryList");
 }


这样就OK了


第二种:弹出式透明背景的模式

1.在模板目录的/__master/Snippets/有个FlyoutNode.html,复制一份重命名为FlyoutNode_Rel.html

把里面的内容修改为:
<li%%GLOBAL_FlyoutAttributes%%><a href="%%GLOBAL_FlyoutNodeUrl%%" rel="nofollow">%%GLOBAL_FlyoutNodeLabel%%</a>%%GLOBAL_FlyoutChildHtml%%</li>


2.修改lib/store/sitemap/Renderer.php文件

找到:protected $_nodeTemplate = 'FlyoutNode';
在他下面添加:    protected $_nodeTemplate_1 = 'FlyoutNode_Rel';

找到   

public function getNodeTemplate ()

{
        return $this->_nodeTemplate;
 }


在他下面添加:
//Arlinger info
public function setNodeTemplate_Rel ($value)
{
  $this->_nodeTemplate_Rel = (string)$value;
  return $this;
}
//Arlinger info
public function getNodeTemplate_Rel()
{
   return $this->_nodeTemplate_Rel;
}


找到:$GLOBALS['FlyoutNodeLabel'] = isc_html_escape($node->getLabel());

改为:

$catName_1= isc_html_escape($node->getLabel());

$GLOBALS['FlyoutNodeLabel'] = $catName_1;

找到:$html = $this->getTemplateEngine()->GetSnippet($this->getNodeTemplate());
改为:
if($catName_1=='Others' or $catName_1=='Recommended')
{
    $html = $this->getTemplateEngine()->GetSnippet($this->getNodeTemplate_1());
}else{                    
    $html = $this->getTemplateEngine()->GetSnippet($this->getNodeTemplate());
}



好了,大功告成~


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值