Loading... 由于原八七娱乐网数据丢失,我改名为爱好者,为了站点收录,于是接入百度熊掌号,以便百度熊掌号对原创文章的收录和搜索结果以及熊掌号页面的展现效果借助网上搜到的一些代码进行了简单的更改以便更加适配当前使用的 Typecho 主题,终于完成了 Typecho 熊掌号的页面改造。 首先我们需要修改当前主题的 header.php 和 footer.php 文件,在里面分别添加代码,以实现熊掌号的页面改造,具体如下: #### 1、header.php文件的修改 由于 Typecho 默认是没 Canonical 标签的,所以我们要在 Header 中加入 Canonical 标签。 以handsome主题为例,修改:/usr/themes/handsome/component/header.php 文件加入: <code><link rel="canonical" href="<?php $this->permalink() ?>"/></code> #### 2、footer.php文件的修改 以handsome主题为例,修改:/usr/themes/handsome/component/footer.php文件。 在 <code><?php $this->footer(); ?> </code>后加入: <script type="application/ld+json"> { "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld", "@id": "<?php $this->permalink() ?>", "appid": "你的 APPID", "title": "<?php $this->title() ?>", "images": ["<?php $this->fields->XZHimages(); ?>"], "description": "<?php $this->description() ?>", "pubDate": "<?php $this->date('Y-m-d\TH:i:s'); ?>" } </script> <script src="//msite.baidu.com/sdk/c.js?appid=你的 APPID"></script> 只要将 你的 APPID 修改为你的 APPID 就 ok 了! 各大影视平台会员最低仅需要5折,电费/话费等92折起步错过等一年 【点击查看】。 最后修改:2018 年 12 月 10 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏
2 条评论
支持支持!
感谢支持