zoukankan      html  css  js  c++  java
  • discuz 门户页模板中的keywords和description不能正常显示

    最近用discuz搭建了一个素食网,在处理门户页模板时,发现虽然在后台的seo设置了keywords和description,但是以游客的身份访问时,不显示后台设置的内容,显示为:

    <meta name="keywords" content="首页" />
    
    <meta name="description" content="首页" />
    

     当以管理员身份登录后,查看首页源代码,竟然可以正常显示:

    <meta name="keywords" content="素食,素食菜谱,素食养生,素食餐厅,素食者,素食文化,素食主义" />
    <meta name="description" content="中国素食网弘扬中国素食文化,为您介绍有关素食养生、素食保健、素食菜谱等素食常识,及时发布有关素食的资讯信息,让素食爱好者更懂素食、爱素食、爱健康. " />
    

     解决办法:

    首先找到根目录下的/source/class/helper/helper_seo.php文件,找到以下代码并修改:

    //if($descriptiontext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {//源代码
    if($descriptiontext) {//修改后的代码
    				$seodescription = helper_seo::strreplace_strip_split($searchs, $replaces, $descriptiontext);
    			}
    //if($keywordstext && (isset($_G['makehtml']) || CURSCRIPT == 'forum' || IS_ROBOT || $_G['adminid'] == 1)) {//源代码
    if($keywordstext) {//修改后的代码
    				$seokeywords = helper_seo::strreplace_strip_split($searchs, $replaces, $keywordstext);
    			}
    

     修改后保存,是首页刷新试试。

     
  • 相关阅读:
    C/C++ 读文件
    算法和数据结构 图表示
    protobuf
    C/C++ jsoncpp
    C/C++ C++11作用域枚举
    腾讯云云函数快速入门实践
    Serverless 与 Flask 框架结合进行 Blog 开发
    从企业微信机器人到小爱同学,用 Serverless 实现生活智能化!
    基于 Serverless 与 Websocket 的聊天工具实现
    云函数 SCF 与对象存储实现 WordCount 算法
  • 原文地址:https://www.cnblogs.com/daly2008/p/3682228.html
Copyright © 2011-2022 走看看