织梦后台title标题SEO优化方法
1、首页:
<title>{dede:global.cfg_webname/}</title>,在“系统设置”→“系统基本参数”中将首页的标题信息都写在网站名称里面。
2、栏目页:
找到include/typelink.class.php第164行左右,找到
$this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName;
修改为:
查看代码打印
$this->valuePositionName = $this->valuePositionName.$this->SplitSymbol.$tinfos['typename'];
3、接下来将列表页模板上默认的标题标签
<title>{dede:field.title/} - {dede:global.cfg_webname/}</title>
修改为:
<title>{dede:field.seotitle /} {dede:field.title function='ereg_replace(" - "," - ",@me)'/} - {dede:global.cfg_webname/}</title>
即可。
4、第一个标签{dede:field.seotitle /} 是调用栏目的SEO标题。如果您对栏目中间的连接符不满意,可以修改include/arc.listview.class.php,找到55行
$this->Fields['title'] = ereg_replace("[<>]"," / ",$this->TypeLink->GetPositionLink(false));
把 / 删除 注意留一个空格 " "
5、文章页:
<title>{dede:field.seotitle/} {dede:field name='title'/}-{dede:field name='position' runphp='yes'}
$tc="-"; //分隔符
$tw=$GLOBALS['cfg_list_symbol']; //调用位置分隔符
@me=html2text(@me); //去除html标签
$tf=split($tw,@me); //分解成数组
for($ta=(count($tf)-2);$ta>=1;$ta--){ //循环赋值给$tk
$tk.=trim($tf[$ta]).$tc;
}
$tk=substr($tk,0,-1);
@me=$tk; //赋值给@me
{/dede:field}-{dede:global name='cfg_webname'/}</title>
1、还有一种优化方案是:
首页:
<title>{dede:global.cfg_webname/}</title>,在“系统设置”→“系统基本参数”中将首页的标题信息都写在网站名称里面。
栏目页:(跟上一种优化方案不一样)
找到include/typelink.class.php第164行左右,找到
$this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName;
修改为:
$this->valuePositionName = $tinfos['typename'].$this->SplitSymbol.$this->valuePositionName;
接下来将列表页模板上默认的标题标签
<title>{dede:field.title/} - {dede:global.cfg_webname/}</title>
修改为:
<title>{dede:field.title/}_{dede:field.seotitle /}_{dede:global.cfg_webname/}</title>
即可。
最后在栏目页的高级选项中把需要优化的关键词写入SEO标题中即可