申请加入百度熊掌号后,先要绑定域名,然后就是提交资源,在提交资源的说明中需要符合验证要求,在“粉丝关注”菜单中有具体要求:

1、在H5页面需要在<head></head>之间添加:
<script src="//msite.baidu.com/sdk/c.js?appid=0123456789abcdef"></script>
2、而在MIP页面中需要添加两段代码:
2.1、引入熊掌号MIP组件的SDK
在页面mip.js代码<script src="https://c.mipcdn.com/static/v1/mip.js"></script>之后、</body>标签前添加代码:
<script src="https://c.mipcdn.com/extensions/platform/v1/mip-cambrian/mip-cambrian.js"></script>
2.2、使用熊掌号MIP组件
在页面<body>标签后添加代码:
<mip-cambrian site-id="0123456789abcdef"></mip-cambrian>
在MediaWiki里面我是修改的LocalSettings.php文件来实现插入一上代码,并且通过判断当前网站来插入不同的代码,m.网站插入H5代码,mip.网站插入MIP代码。
另外,在百度熊掌号后台的“在线校验工具”还会验证ld+json数据,我在网上查了一下,安装了这个插件:Google Rich Cards,我使用这个插件新版本的事情有点问题,去找了一个老版本,安装后修改里面的GoogleRichCards.php文件,添加百度熊掌号要求的代码:
<script type="application/ld+json">
{
"@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
"@type": "Article",
"@id": "'.$wgTitle->getFullURL().'",
"appid": "0123456789abcdef",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "'.$wgTitle->getFullURL().'"
},
"author": {
"@type": "Person",
"name": "'.$author.'"
},
"headline": "'.$wgTitle.'",
"title": "'.$wgTitle.'",
"dateCreated": "'.$created_timestamp.'",
"datePublished": "'.$created_timestamp.'",
"pubDate": "'.substr($created_timestamp,0,19).'",
"dateModified": "'.$modified_timestamp.'",
"upDate": "'.substr($modified_timestamp,0,19).'",
"discussionUrl": "'.$wgServer.'/'.$wgTitle->getTalkPage().'",
"image": {
"@type": "ImageObject",
"url": "'.$image_url.'",
"height": '.$image_height.',
"width": '.$image_width.'
},
"publisher": {
"@type": "Organization",
"name": "'.$wgSitename.'",
"logo": {
"@type": "ImageObject",
"url": "'.$wgServer.$wgLogo.'"
}
}
}
</script>
这样提交验证就可以通过。也可能还会遇到其它报错,例如canonical标签方面的问题,具体可以参考熊掌号《常见类型错误》来针对性修改。
评论