帝国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>
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。