- A+
熊掌号主页改造(织梦版):
html代码改造部分
添加熊掌号声明ID:
<script src="//msite.baidu.com/sdk/c.js?appid=这里是熊掌号ID">
1. 在<head></head>之间添加添加canonical标签
<link rel="canonical" href="{dede:globle_cfg.basehost/}{dede:field name='arcurl'/}"/>
dedeCMS的{dede:field name='arcurl'/}可以调用相对位置的url,但是熊掌号要求绝对地址;
2. 添加JSON-LD数据,添加于<body></body>之前就好,一般添加于末尾
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{dede:globle_cfg.basehost/}{dede:field name='arcurl'/}",
"appid": "熊掌号ID",
"title": "{dede:field.title/}",
"images": [
"{dede:globle_cfg.basehost/}{dede:field.litpic/}",
"{dede:globle_cfg.basehost/}{dede:field.ppic2/}",
"{dede:globle_cfg.basehost/}{dede:field.ppic3/}"
],
"description": "{dede:field name='description' function='html2text(@me)'/}",
"pubDate": "{dede:field name='pubdate' function='strftime("%Y-%m-%dT%H:%M:%S","@me")' /}"
}
</script>
熊掌号参数字段解析
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{dede:field.arcurl/}",
"appid": "熊掌号ID",
"title": "{dede:field.title/}",
"images": [
"{dede:field.picname/}"
],
"pubDate": "{dede:field name='pubdate'function='strftime("%Y-%m- %dT%H:%M:%S",@me)' /}"
}
</script>
