资讯中心
News
织梦dedecms各大搜索引擎移动端适配规则
发布时间:2019-01-22 13:18   您所在的位置: 网站首页 > 新闻资讯 > 建站知识
移动端的时代,大部分的dede企业网站的没有考虑过移动端怎么去改版(移动端改版可以参考:手机端仿站),怎么去获得流量,本内容主要内容为百度、360、搜狗、神马等搜索引擎移动适配规则。

从dede的程序分析,可以得出三种链接出来。

首页
列表页
内容页(包含专题页)
三种链接格式出来,两个格式即可。

URL格式(PC链接:https://www.jianzhan0.com   移动端链接:https://m.jianzhan0.com)

Pattern模式(需要对正则了解个P)

那么对应的首页、列表页直接使用URL格式即可,而内容页因为内容量级的问题,所以只能使用Pattern模式,来匹配链接。

百度移动适配规则

内容页移动适配
站点网址:http://zhanzhang.baidu.com/

#(\w+)代表字符串,(\d+)表示数字
https://www.jianzhan0.com/(\w+)/(\d+).html     #对应着:https://www.jianzhan0.com/naipingjia/993.html
https://www.jianzhan0.com/(\w+)/(\w+)/(\d+).html   #对应着:https://www.jianzhan0.com/yuerzhishi/baobaohulizhishi/725.html
#${2} 对应着上面第一条的第二个参数,第二个数字为内容的ID值 ,同理${3}对应的是第三个参数
https://m.jianzhan0.com/view.php?aid=${2}    #对应着:https://m.jianzhan0.com/view.php?aid=993
https://m.jianzhan0.com/view.php?aid=${3}    #对应着:https://m.jianzhan0.com/view.php?aid=725
dedecms各大搜索引擎移动端适配规则

列表页适配
因为dede列表页,与移动的无逻辑性的关系,所以就要使用URL的方式提交链接。(当然您说你的移动端做了伪静态,你的PC做了动态就寻其他的方法吧)。

如果只是几个栏目,那么还好处理,如果像待产包最全清单网站130多个栏目,那估计就搞死个人了。看dede仿站里面有一篇这样的内容dede仿站第四课:为了他(她)套上它,可以通过标签获取到栏目的链接,这样就解决了。

#下面注释仅供理解阅读使用,如需使用,请删除注释内容
{dede:channelartlist row=100 typeid='top'}
#获取顶级栏目的链接,以及ID值,pc链接与移动链接中间用空格隔开(百度使用,其他的搜索引擎是TAB间隔)
https://www.jianzhan0.com{dede:field name='typeurl'/} https://m.jianzhan0.com/list.php?tid={dede:field name='id'/}
#获取顶级栏目下的下级栏目的链接,以及ID值
{dede:channel type='son' noself='true'}
https://www.jianzhan0.com[field:typelink/]  https://m.jianzhan0.com/list.php?tid=[field:id/]<br>
{/dede:channel}
{/dede:channelartlist}
上述代码可以放在任何一个模板位置上,当然建议还是放在底部,收集到栏目相关链接后,然后就修改过来。

dedecms各大搜索引擎移动端适配规则

剩下的就是提交规则,等到百度审核。

360移动适配

360站长:http://zhanzhang.so.com/

列表页适配
url匹配规则,中间间隔换为tab键,保存为txt文件放置到网站任意目录。

内容页移动适配
与百度的规则无多大区别,只是${2}换成了\2

#(\w+)代表字符串,(\d+)表示数字
https://www.jianzhan0.com/(\w+)/(\d+).html     #对应着:https://www.jianzhan0.com/naipingjia/993.html
https://www.jianzhan0.com/(\w+)/(\w+)/(\d+).html   #对应着:https://www.jianzhan0.com/yuerzhishi/baobaohulizhishi/725.html
#${2} 对应着上面第一条的第二个参数,第二个数字为内容的ID值 ,同理${3}对应的是第三个参数
https://m.jianzhan0.com/view.php?aid=\2    #对应着:https://m.jianzhan0.com/view.php?aid=993
https://m.jianzhan0.com/view.php?aid=\3    #对应着:https://m.jianzhan0.com/view.php?aid=725
搜狗移动适配

搜狗站长:http://zhanzhang.sogou.com/

列表页适配
搜狗的URL适配跟其他的搜索引擎都不一样,需要是xml格式,且还有一堆参数。

如果你栏目的比较多,那么建议您,看看python的文件操作,这样几百个链接瞬间也可以处理完成。

<?xml version="1.0" encoding="UTF-8" ?>
<!-- XML文件需以utf-8编码 -->
<urlset>
    <url>
        <loc>https://www.jianzhan0.com/</loc>  # PC链接
        <data>
            <display>
                <url_pattern>https://m.jianzhan0.com/</url_pattern> #移动端链接
                <version>7</version>
            </display>
        </data>
    </url>
# 第二组
    <url>
        <loc>https://www.jianzhan0.com/yunmaqingdan/</loc>
        <data>
            <display>
                <url_pattern>https://m.jianzhan0.com/list.php?tid=42</url_pattern>
                <version>7</version>
            </display>
        </data>
    </url>
#第二组结束,以<url>开头</url>结束
</urlset>
内容页移动适配
<?xml version="1.0" encoding="UTF-8" ?>
<!-- XML文件需以utf-8编码 -->
<urlset>
    <url>
        <loc>https://www.jianzhan0.com</loc> #入口链接
        <data>
            <display>
                <pc_url_pattern>https://www.jianzhan0.com/(\w+)/(\d+).html</pc_url_pattern>
                <url_pattern>https://m.jianzhan0.com/view.php?aid=${2}</url_pattern>
                <pc_sample>https://www.jianzhan0.com/naipingjia/993.html</pc_sample> #符合上述规则的PC链接
                <wap_sample>https://m.jianzhan0.com/view.php?aid=993</wap_sample> #符合上述规则的移动端链接
                <version>7</version>
            </display>
        </data>
    </url>
# 第二组开始
        <url>
        <loc>https://www.jianzhan0.com</loc>
        <data>
            <display>
                <pc_url_pattern>https://www.jianzhan0.com/(\w+)/(\w+)/(\d+).html</pc_url_pattern>
                <url_pattern>https://m.jianzhan0.com/view.php?aid=${3}</url_pattern>
                <pc_sample>https://www.jianzhan0.com/yuerzhishi/baobaohulizhishi/725.html</pc_sample>
                <wap_sample>https://m.jianzhan0.com/view.php?aid=725</wap_sample>
                <version>7</version>
            </display>
        </data>
    </url>
#第二组结束,以<url>开头</url>结束  
</urlset>
制作完成,保存xml文件格式,上传到网站。

 

神马移动适配

神马站长:http://zhanzhang.sm.cn/

列表页适配
url匹配规则,中间间隔换为tab键,保存为txt文件放置到网站任意目录。同360搜索引擎

内容页移动适配
<?xml version="1.0" encoding="UTF-8"?>
<urlset>
<url>
    <loc>https://www.jianzhan0.com</loc> #网站首页
    <data>
        <display>
            <pc_url_pattern>
                https://www.jianzhan0.com/(\w+)/(\d+).html
            </pc_url_pattern>  #PC端网页
            <xhtml_url_pattern >
                https://m.jianzhan0.com/view.php?aid=${2}
            </xhtml_url_pattern> #html5手机页
        </display>
    </data>
</url>
#第二组开始
<url>
    <loc>https://www.jianzhan0.com</loc>
    <data>
        <display>
            <pc_url_pattern>
                https://www.jianzhan0.com/(\w+)/(\w+)/(\d+).html
            </pc_url_pattern>
            <xhtml_url_pattern >
                https://m.jianzhan0.com/view.php?aid=${2}
            </xhtml_url_pattern>
        </display>
    </data>
</url>
#第二组结束,以<url>开头</url>结束    
</urlset>
至此各大搜索引擎的移动适配规则告一段落,可能会有所偏差,但上述的内容应该通用于大部分的dede网站的移动适配。
本文章由新概念互动原创,如没特殊注明,转载请注明来自:http://www.jianzhan0.com/zhishi/49506.html