百度出了极光算法,需要改造的代码总结如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<script type="application/ld+json"> { "@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id":"当前页面地址,必填", "appid":"熊掌号ID,纯PC端页面可不填", "title":"网页的标题,选填", "images":["当前文章页的第一张图片,选填"], "description":"当前页面的描述内容,选填", "pubDate":"文章发布时间,必选", "upDate":"页面更新时间,必填", "data":{ "webPage":{ "headline":"页面文章的标题,选填", "tag":["页面标签,选填"], "pcUrl":"PC端的URL地址,建议填", "wapUrl":"移动端的URL地址,自适应与PC端地址一样,建议填", "mipUrl":"MIP页面的地址,建议有的填 没有就不填", "fromSrc":"站点名称,注意这里不建议写标题,建议用品牌名,选填", "datePublished":"内容发布的时间,选填" } } } </script> |
织梦系统一共有首页、列表、内容这三种类型,所以一共有三段代码:
首页修改:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<script type="application/ld+json"> { "@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id":"{dede:global.cfg_basehost/}", "appid":"{dede:global.xiongzhang_id/}", "title":"{dede:global.SiteTitle/}", "images":["{dede:global.cfg_basehost/}/templets/winow/images/winow-logo.jpg"], "description":"{dede:global.cfg_description/}", "upDate":"{dede:arclist row='1' typeid='all' orderby='pubdate'}[field:pubdate function='strftime("%Y-%m-%dT%H:%M:%S",@me)' /]{/dede:arclist}", "data":{ "webPage":{ "pcUrl":"{dede:global.cfg_basehost/}", "wapUrl":"{dede:global.cfg_mob_url/}", "mipUrl":"{dede:global.cfg_mob_url/}", "fromSrc":"{dede:global.cfg_webname/}" } } }</script> |
列表页修改:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<script type="application/ld+json"> { "@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id":"{dede:global.cfg_basehost/}{dede:type}[field:typelink/]{/dede:type}", "appid":"{dede:global.xiongzhang_id/}", "title":"{dede:field name='typename'/}", "images":["{dede:field.typepic runphp="yes"} //这里的typepic是自己添加的栏目缩图 @me = (strpos(@me,'defaultpic')? "{dede:global.cfg_basehost/}/templets/winow/images/winow-logo.jpg" : 'https://www.winowalu.cn'.@me."");{/dede:field.typepic}"], "description":"{dede:field.description function='html2text(@me)'/}", "pubDate":"{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}T{dede:field.pubdate function="MyDate('H:i:s',@me)"/}", "data":{ "webPage":{ "pcUrl":"{dede:global.cfg_basehost/}{dede:type}[field:typelink/]{/dede:type}", "wapUrl":"{dede:global.cfg_basehost/}{dede:type}[field:typelink/]{/dede:type}", "mipUrl":"{dede:global.cfg_mob_url/}/list.php?tid={dede:field.id/}", "fromSrc":"{dede:global.cfg_webname/}" } } } </script> |
这里特别说一些:如果是封面页不更新内容的建议直接写链接,时间等;如果是列表页需要更新内容的栏目页可以把栏目页发布时间固定,栏目内容更新时间换成如下代码
1 |
"upDate":"{dede:arclist row='1' typeid='all' orderby='pubdate'}[field:pubdate function='strftime("%Y-%m-%dT%H:%M:%S",@me)' /] {/dede:arclist}", |
说明:typeid=” 栏目ID” 可以直接写栏目ID,建议写ALL
内容页修改:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<script type="application/ld+json"> { "@context":"https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id":"{dede:global.cfg_basehost/}{dede:field name='arcurl'/}", "appid":"{dede:global.xiongzhang_id/}", "title":"{dede:field.shorttitle/}", "images":["{dede:field.litpic runphp="yes"} global $cfg_basehost; @me = (strpos(@me,'defaultpic')? "" : "$cfg_basehost".@me.""); {/dede:field.litpic}"], "description":"{dede:field.description function='html2text(@me)'/}", "pubDate": "{dede:field.senddate function="MyDate('Y-m-d\TH:i:s',@me)"/}", "upDate": "{dede:field.pubdate function="MyDate('Y-m-d\TH:i:s',@me)"/}", "data":{ "webPage":{ "pcUrl":"{dede:global.cfg_basehost/}{dede:field name='arcurl'/}", "wapUrl":"{dede:global.cfg_mob_url/}/view.php?aid={dede:field name='id'/}", "mipUrl":"{dede:global.cfg_mob_url/}/view.php?aid={dede:field name='id'/}", "fromSrc":"{dede:global.cfg_webname/}" } } } </script> |
未经允许不得转载:Windy's Blog » 织梦极光算法时间因子改造代码