织梦DEDECMS熊掌号JSON LD结构化数据代码分享

织梦DEDECMS熊掌号JSON LD结构化数据代码分享

效果:

注意:@id里面的地址必须是自适应网站或者手机站,pc端链接是不支持!

百度官方JSON-LD示例:

<script type="application/ld+json">
    {
        "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
        "@id": "https://ziyuan.baidu.com/college/articleinfo?id=1464",
        "appid": "1582926961485115",
        "title": "百度移动搜索落地页体验白皮书——广告篇2.0",
        "images": [
            "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png",
            "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png",
            "https://m.baidu.com/static/index/plus/plus_logo.png"
            ],
        "description": "优质合理的广告作为信息的补充,广受用户喜欢。2017年初百度用户体验部针对用户进行了满意度调研,发现很多恶意低质的广告严重破坏着用户的搜索体验。",
        "pubDate": "2017-06-15T08:00:01"
    }
</script>

织梦DEDECMS熊掌号JSON LD结构化数据代码分享

文章内容页调用代码:

<script type="application/ld+json"> {
  "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
  "@id": "{dede:global.cfg_basehost/}{dede:geturl runphp='yes'}
@me = GetCurUrl();
{/dede:geturl}",
  "appid": "你的熊掌号ID",
  "title": "{dede:field.title/}",
  "images": [
  "{dede:global.cfg_basehost/}{dede:field.litpic/}"
   ], 
  "description":"{dede:field.description function=html2text(@me)/}",
  "pubDate":"{dede:field.pubdate function="MyDate('Y-m-d\TH:i:s',@me)"/}",
  "Update":"{dede:field.pubdate function="MyDate('Y-m-d\TH:i:s',@me)"/}"
  }
  </script>

首页调用代码:

<script type="application/ld+json"> {
  "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
  "@id": "{dede:global.cfg_basehost/}",
  "appid": "你的熊掌号ID",
  "title": "{dede:global.cfg_webname/}",
  "images": [
  "https://www.xycn.org/style/images/logo.png"
   ], 
   "description":"{dede:global.cfg_description/}",
  "pubDate": "{dede:tagname runphp='yes'}@me = date("Y-m-d\TH:i:s", time());{/dede:tagname}"
  }
  </script>

 

 

THE END