织梦dedecms网站怎么进行熊掌号改造呢?今天就给大家说下织梦cms制作的网站,熊掌号改造的方法。
第一步:添加熊掌号id声明
在页面</head>标签前添加代码
<script src="//msite.baidu.com/sdk/c.js?appid=你的id"></script>
第二步:添加canonical标签
//自动获取织梦当前页链接
<link rel="canonical" href="{dede:global.cfg_basehost/}{dede:field name='arcurl'/}"/>
//这里冬镜特别提醒:必须写变量,不要去写固定链接要求href的内容为mip页或h5页对应的pc页地址;如果没有pc端页,则填写当前移动端页面地址,位置在<head>标签内。
第三步:添加json_ld数据
<script type="application/ld+json">
{
	"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
	"@id": "{dede:global.cfg_basehost/}{dede:field name='arcurl'/}",
	"appid": "你的id",
	"title": "{dede:field.title/}",
	"images": [
		  "{dede:field.litpic /}"  //获取文章第一张图片
		],
	"description": "{dede:field.description function='html2text(@me)'/}",
	"pubdate": "{dede:field.pubdate function="mydate('y-m-dth:i:s',@me)"/}"
}
</script>