我最开始整理过一个杰奇熊掌号改造的,但是那个其实问题很多,而且最近发现百度的熊掌号更新了一些东西,所以决定先自己测试然后整理比较全的教程。其实熊掌号改造是没有必要全站改造的,主要集中在内容就好,特别是需要原创保护的网站,熊掌号用处很大,而做采集的网站,通过伪原创也能非常快的提升收录。以下的整理是已经测试过的,基本上配置成功,而且现在可以自动同步,十分爽快。
教程如下,一般情况下主要在三个文件:
1.首先,明确熊掌号需要的js,大概有如下,熊掌号后台会提供:
这三句不能缺少
<script src="https://xiongzhang.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<script src="//msite.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<link rel="canonical" href="当前页面url"/>
其次就是json格式
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "https://www.example.com/******",
"appid": "1611187255243322",
"title": "页面标题******",
"images": [
"https://www.example.com/***/pic1.png",
"https://www.example.com/***/pic2.png",
"https://www.example.com/***/pic3.png"
], //请在此处添加希望在搜索结果中展示图片的url,可以添加0个、1个或3个url
"pubDate": "2017-06-15T08:00:01" // 需按照yyyy-mm-ddThh:mm:ss格式编写时间,字母T不能省去
}
</script>
2.随后开始修改杰奇模板文件
第一个是themes文件夹下网站风格文件里面的theme.html,head标签对中加上如下代码:
{?if $jieqi_thisfile|basename == 'articleinfo.php'?}
<script src="https://xiongzhang.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<script src="//msite.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<link rel="canonical" href="{?$url_articleinfo?}"/>
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{?$url_articleinfo?}",
"appid": "1611187255243322",
"title": "{?$articlename?}",
"images": [
"{?$url_limage?}"
],
"description": "{?$intro|htmlclickable?}",
"pubDate": "{?$postdate|date:'Y-m-d'?}T{?$postdate|date:'H:i:s'?}",
"upDate": "{?$lastupdate|date:'Y-m-d'?}T{?$lastupdate|date:'H:i:s'?}"
}
</script>
{?/if?}
代码可能出现乱码,截图如下:
第二个是/modules/article/templates下的index.html
<script src="https://xiongzhang.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<script src="//msite.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<link rel="canonical" href="{?$url_index?}"/>
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{?$url_index?}",
"appid": "1611187255243322",
"title": "{?$articlename?}",
"images": [
"{?$url_limage?}"
],
"description": "{?$intro|htmlclickable?}",
"pubDate": "{?$postdate|date:'Y-m-d'?}T{?$postdate|date:'H:i:s'?}",
"upDate": "{?$lastupdate|date:'Y-m-d'?}T{?$lastupdate|date:'H:i:s'?}"
}
</script>
代码可能出现乱码,截图如下:
第三个是/modules/article/templates下的style.html
<script src="https://xiongzhang.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<script src="//msite.baidu.com/sdk/c.js?appid=1611187255243322"></script>
<link rel="canonical" href="{?$jieqi_url?}/html/{?$articleid?}/{?$chapterid?}.html"/>
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{?$jieqi_url?}/html/{?$articleid?}/{?$chapterid?}.html",
"appid": "1611187255243322",
"title": "{?$articlename?}-{?$chaptername?}",
"images": [
"{?$url_limage?}"
],
"description": "{?$author?}最新力作{?$articlename?},当前章节为{?$chaptername?},希望各位读者多多支持!{?$author?}将为大家带来更好的作品。",
"pubDate": "{?$postdate|date:'Y-m-d'?}T{?$postdate|date:'H:i:s'?}",
"upDate": "{?$lastupdate|date:'Y-m-d'?}T{?$lastupdate|date:'H:i:s'?}"
}
</script>
代码可能出现乱码,截图如下:
3.最后就去官网校验一下,就知道是否成功
教程就到这里,转载注明来源
本文来自投稿,不代表本站立场,如若转载,请注明出处:https://www.ruletree.club/archives/837/