织梦dedecms站如何获取电脑站与手机站的跳转适配地址

这时我轻轻地闭上了眼睛,我好像来到童话世界,好像在和小鸟讨论秋天的美景,好像在和小草拍秋天的照片。农民伯伯在田野里收获了庄稼,果农们在果园里收获了果子,我们在学校里收获快乐、收获知识、收获成长。

织梦自从升级了手机端功能之后,用织梦系统做电脑站跟手机站共存的网站就越来越容易了,而且还可以做到数据的同步,维护起来也十分的方便,而且手机端也可以实用通用的织梦标签调取内容,真的特别好用。

但是,还有一个就是手机站跟电脑站的适配问题,跳转适配什么的就不说了,说下官方新出的标签,alternate跟canonical,这个标签是指定百度手机站跟电脑站对应关系的。

在此配置中,每个pc版网址都具有一个对应的不同网址,用于提供针对移动设备进行优化的内容。为了帮助我们的算法了解单独的移动版网址,我们建议您使用以下注释:

在pc版网页上,添加指向对应移动版网址的特殊链接rel="alternate"标记。这有助于发现网站的移动版网页所在的位置。

在移动版网页上,添加指向对应pc版网址的链接rel="canonical"标记。

具体的写法是pc端:<link rel="alternate" media="only screen and(max-width: 640px)" rel="nofollow noopener noreferrer" href="" >

手机端:<link rel="canonical" rel="nofollow noopener noreferrer" href="" >

在织梦后台系统设置里添加cfg_m全局变量,变量值是你的手机网址。

织梦跳转适配-电脑端的写法:

首页:<link rel="alternate" media="only screen and(max-width: 640px)" rel="nofollow noopener noreferrer" href="{dede:global.cfg_m/}" >

列表页:<link rel="alternate" media="only screen and(max-width: 640px)" rel="nofollow noopener noreferrer" href="{dede:global.cfg_m/}/list.php?tid={dede:field.id/}" >

内容页:<link rel="alternate" media="only screen and(max-width: 640px)" rel="nofollow noopener noreferrer" href="{dede:global.cfg_m/}/view.php?aid={dede:field.id/}" >

频道封面:<link rel="alternate" media="only screen and(max-width: 640px)" rel="nofollow noopener noreferrer" href="{dede:global.cfg_m/}{dede:type}[field:typelink /]{/dede:type}" >

织梦跳转适配-手机端的写法:

首页:<link rel="canonical" rel="nofollow noopener noreferrer" href="{dede:global.cfg_basehost/}" >

列表页:<link rel="canonical" rel="nofollow noopener noreferrer" href="{dede:global.cfg_basehost/}{dede:type}[field:typelink /]{/dede:type}" >

内容页:<link rel="canonical" rel="nofollow noopener noreferrer" href="{dede:global.cfg_basehost/}{dede:type}[field:typelink /]{/dede:type}{dede:field.id/}.html" >

频道封面:<link rel="canonical" rel="nofollow noopener noreferrer" href="{dede:global.cfg_basehost/}{dede:type}[field:typelink /]{/dede:type}" >

本文织梦dedecms站如何获取电脑站与手机站的跳转适配地址到此结束。人的一生是漫长的,但关键的只有几步。小编再次感谢大家对我们的支持!

您可能有感兴趣的文章
织梦后台文档列表添加复制文档功能支持所有模型

织梦无法上传ico图标格式文件的如何解决方法

dedecms如何实现任意页面调用当前会员信息的方

织梦dede:tag调用指定多个栏目的TAG标签

织梦栏目列表按附加表自定义字段排序