「自学哈网」帝国cms模板改造加熊掌号推送代码包含首页列表页和内容页
也想出现在这里?
联系我们吧
给帝国CMS模板加熊掌号推送代码比如首页模板、列表页模板和内容页模板代码。只需要复制对应的代码即可完成改造。
以下代码加入到head标签中。
首页代码:
<link rel="canonical" href="[!--news.url--]" /> <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script> <script type="application/ld+json"> { "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id": "[!--news.url--]", "appid": "自己的熊掌id", "title": "[!--pagetitle--]", "images": [ "https://网站的LOGO地址/logo.png", "", "" ], "description": "[!--pagedes--]", "pubDate": "<?=date('Y-m-d')?>T<?=date('H:i:s')?>", "isOriginal": "1" } </script>
列表页代码(多图的):
<link rel="canonical" href="[!--titleurl--]" /> <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script> <script type="application/ld+json"> { "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id": "[!--titleurl--]", "appid": "自己的熊掌id", "title": "[!--pagetitle--]", "images": [ "<?=$navinfor[titlepic]?>", "<?=$_img[0][1]?>", "<?=$_img[0][2]?>" ], "description": "[!--smalltext--]", "pubDate": "<?=date('Y-m-d',$navinfor[newstime])?>T<?=date('H:i:s',$navinfor[newstime])?>", "isOriginal": "1" } </script>
下面这段代码放模板顶部用于提取图片:
<?php $_class=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'"); $_classimg = "22541524.png"; if (empty($_class[classimg])) {$_class[classimg] = $_classimg;} ?>
<link rel="canonical" href="[!--titleurl--]" /> <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script> <script type="application/ld+json"> { "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id": "[!--titleurl--]", "appid": "自己的熊掌id", "title": "[!--pagetitle--]", "images": [ "<?=$navinfor[titlepic]?>", "", "" ], "description": "[!--smalltext--]", "pubDate": "<?=date('Y-m-d',$navinfor[newstime])?>T<?=date('H:i:s',$navinfor[newstime])?>", "isOriginal": "1" } </script> 内容页单个图的代码: <link rel="canonical" href="[!--titleurl--]" /> <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script> <script type="application/ld+json"> { "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id": "[!--titleurl--]", "appid": "自己的熊掌id", "title": "[!--pagetitle--]", "images": [ "<?=$navinfor[titlepic]?>", "", "" ], "description": "[!--smalltext--]", "pubDate": "<?=date('Y-m-d',$navinfor[newstime])?>T<?=date('H:i:s',$navinfor[newstime])?>", "isOriginal": "1" } </script>
以下代码放到模板顶部用于提取图片,当没图片的时候用缩略图代替
<?php $_titlepic = "https://logo图片地址/logo.png"; if (empty($navinfor[titlepic])) {$navinfor[titlepic] = $_titlepic;} ?>
上面代码都是放在head标签里面,除了底下面声明的要放到模板顶部。
内容页可以根据自己实际使用情况在模板中加入。
本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!
自学哈网 » 「自学哈网」帝国cms模板改造加熊掌号推送代码包含首页列表页和内容页
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!
自学哈网 » 「自学哈网」帝国cms模板改造加熊掌号推送代码包含首页列表页和内容页
也想出现在这里?
联系我们吧