zoukankan      html  css  js  c++  java
  • 为dedecms文章列表页标题增加序号,第二页开始才显示第x页

      想必大伙建站都会写文章,随着时间的推移,你的智慧结晶会越来越多,一般的建站程序早帮你想好了,把这些文章做成一个列表,比如dedecms栏目列表,便于观众浏览,但有个问题就是dedecms文章列表页标题没有序号,如果是默认的话,第N页的标题和第一页的标题一模一样,对se相当不友好,它会认为你的网站重复页面太多,可能会对你的网站区别对待,那就太委屈了。

      那么,怎么为dedecms文章列表页标题增加序号呢?织梦cms有一个文章列表函数:dede:pagelist,但这个函数可能没有具体运用到模板标题中,so,我们来just do it。

      打开/templets/default(模板名)/list_article.htm,找到标题标签(<title>)

    {dede:field.title/} - {dede:global.cfg_webname/} 
    

       改成

    {dede:field.title/} - 第{dede:pagelist listsize='0' listitem='pageno' function='html2text(@me)'/}页 - {dede:global.cfg_webname/}
    

      但是这样还是不够完善,列表第一页还是会重复,比如/js/gdjs/和/js/gdjs/list_73_1.html内容是一样的,却出现了两个url,造成重复内容。我们得继续完善一下

    {dede:field.title/}{dede:pagelist listitem="pageno" listsize="0" function="html2text(@me)" runphp="yes"}if (strlen(@me)>10 || @me==1) @me="";else @me=" - 第".str_replace(' ','',@me)."页";{/dede:pagelist}  -  {dede:global.cfg_webname/}
    

      你试了吗?效果是不是不一样?多一点尝试,多一点发现。参考自“DedeCms栏目列表标题第x页序号的完美修改方法”,请自行搜索。嫌麻烦,试一下拖拽搜索

      既然要做,就做得彻底些,把描述标签(description)也完善一下吧。think more,think better!

  • 相关阅读:
    np.newaxis
    UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 576-577: invalid continuation byte
    shell $() vs ${}
    install docker-ce for ubuntu
    ImportError: pycurl: libcurl link-time ssl backend (nss) is different
    saltstack install on centos7
    pycharm 用远程环境时报错bash: line 0: cd: /home/tmp: No such file or directory
    计算函用运行用时
    scrapy-redis
    merge dict key
  • 原文地址:https://www.cnblogs.com/ytkah/p/3552218.html
Copyright © 2011-2022 走看看