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);
    			}
    

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

     
  • 相关阅读:
    机器学习面试
    网易有道2017内推编程题2道
    老曹眼中的网络编程基础
    MySQL索引背后的数据结构及算法原理
    [oracle] oracle-ibatis-整理
    [oracle] oracle-myibatis-整理
    [mysql] mysql-myibatis-整理
    [JS] selector 背景选择器
    [android] AndroidManifest.xml 详解
    [Eclipse] 项目编码
  • 原文地址:https://www.cnblogs.com/daly2008/p/3682228.html
Copyright © 2011-2022 走看看