以下代码加入到head标签中。
首页代码:
列表页代码(多图的):
- {
- "@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"
- }
内容页单个图的代码:下面这段代码放模板顶部用于提取图片:
- {
- "@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"
- }
- $_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标签里面,除了底下面声明的要放到模板顶部。以下代码放到模板顶部用于提取图片,当没图片的时候用缩略图代替
- {
- "@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"
- }
- $_titlepic = "https://logo图片地址/logo.png";
- if (empty($navinfor[titlepic])) {$navinfor[titlepic] = $_titlepic;}
- ?>
内容页可以根据自己实际使用情况在模板中加入。
本文地址:https://www.kaifamei.com/empirecms_md/89.html