详情页

帝国cms熊掌号应用设置教程

时间:2023年11月10日

编辑:佚名

帝国CMS设置熊掌号,让我们的网站收录更快,下面分享下方案:
设置一个帝国cms 自定义的变量,我它命名位  appid 记得写入缓存
调用:<?=$public_r['add_appid']?>
如果需要在网页显示关注按钮的话 添加一个代码就可以
【注意】这个代码需添加在<body>之后
<script>cambrian.render('head')</script>
下面是我目前使用的熊掌号代码
下列代码添加在</head>之前
首页调用的代码
<link rel="canonical" href="[!--news.url--]"/>
<script src="//msite.baidu.com/sdk/c.js?appid=<?=$public_r['add_appid']?>"></script>
<script  type="application/ld+json"> {
"@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
"@id": "[!--news.url--]",
"appid": "<?=$public_r['add_appid']?>",
"title":"[!--pagetitle--]",
"images": [
"https://www.abc.com/upload/xzh/1.png",
"https://www.abc.com/upload/xzh/2.png",
"https://www.abc.com/upload/xzh/3.png"
],
"description": "[!--pagedes--]",
"pubDate": "<?=date("Y-m-d")?>T<?=date("H:i:s")?>",
"isOriginal": "0"
}</script>
栏目页
<link rel="canonical" href="<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>"/>
<script src="//msite.baidu.com/sdk/c.js?appid=<?=$public_r['add_appid']?>"></script>
<script  type="application/ld+json"> {
"@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
"@id": "<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>",
"appid": "<?=$public_r['add_appid']?>",
"title":"<?php $cr=$empire->fetch1("select bname from phome_enewsclass where classid='".$GLOBALS[navclassid]."' limit 1"); echo $cr['bname']; ?>",
"images": [
"[!--class.classimg--]"
],
"description": "[!--pagedes--]",
"pubDate": "<?=date("Y-m-d")?>T<?=date("H:i:s")?>",
"isOriginal": "0"
}</script>
内容页
<link rel="canonical" href="[!--titleurl--]"/>
<script src="//msite.baidu.com/sdk/c.js?appid=<?=$public_r['add_appid']?>"></script>
<script type="application/ld+json">{
"@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
"@id": "[!--titleurl--]",
"appid": "<?=$public_r['add_appid']?>",
"title":"[!--pagetitle--]",
"images": [
<?php
if($navinfor[titlepic])
{
?>
"[!--titlepic--]"
<?
}
else
{
?>
"https://www.abc.com/upload/xzh/logo_xzh.png"
<?
}
?>
],
"description": "[!--smalltext--]",
"pubDate": "<?php
$t=time();
echo str_replace('CS','',date("Y-m-dTH:i:s",$t));
?>",
"isOriginal": "1"}
</script>
相关文章
猜你需要