公司系统里产品分类名称,有多个重复的“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");
$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';
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());
找到:$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());
}
好了,大功告成~
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());
}
好了,大功告成~