给帝国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 = "https://img.kaituozu.com/img/logo.png";
- if (empty($_class[classimg])) {$_class[classimg] = $_classimg;}
- ?>
上面代码都是放在head标签里面,除了底下面声明的要放到模板顶部。以下代码放到模板顶部用于提取图片,当没图片的时候用缩略图代替
- <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;}
- ?>
本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。
2021-08-29
2021-03-20
2021-08-27
2022-05-29
2022-05-30
2021-08-27
2021-08-27
2022-10-26