|
|
本帖最后由 小华 于 2017-12-7 15:31 编辑
出现问题如下图(该问题经常出现在未登陆情况下,也就是游客访问的时候出现,做SEO的站长都知道,搜索引擎抓取是以游客状态访问网站首页的,具体问题不说你们也知道)
【注明:推荐使用方法一】
方法一
找到文件:source/class/helper/helper_seo.php
在里面找到这样一段话:
- if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {
- $seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext);
- }
- if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {
- $seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext);
- }
复制代码 将其修改为如下:修改完成之后,更新缓存即可。
注意:请备份好源文件,如有问题,方便还原。本方法经discuz x2.5测试可行。
方法二:
找到“template/default/common/header_common.htm ”目录下的文件的9行~10行代买,代码如下:
将其修改为如下:
- <meta name="keywords" content="{if ''==strstr( $_G['setting']['seokeywords']['portal'])} $_G['setting']['seokeywords']['portal'] {/if}" />
- <meta name="description" content="{if ''==strstr($_G['setting']['seodescription']['portal'])} $_G['setting']['seodescription']['portal'] {/if}/>
复制代码
备注:方法二修改后,后台的“全局”->"SEO设置"->“门户”设置中的:例如站点名称bbname前台不解析,前台查看源码中的title,keywords,description还是显示bbname未解析成后台设置的站点名称,现未找到原因,标注下;推荐使用方法一进行解决
DZ站长交流群:493651246
|
评分
-
查看全部评分
|